New code can call the method without having first to retrieve the raw
FILE* pointer via Get().
Also, move implementation to the cpp file. Can be reviewed with:
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
This is a partial backport of core#28060
https://github.com/bitcoin/bitcoin/pull/28060/commits/000019e158ef01f2bedc3fc1589f95e106e817ea
Depends on D18982