Allow for errors to be reported to a file instead of stderr
The Problem
Today, any errors in chunkio file operations will be reported to stderr. This is not a big deal when running an application using this library as a direct binary, since there are methods to redirect stderr when running directly. When running as a systemd service, you can set a StandardError configuration to report stderr to a file. The main situation where there is no recourse for this is when running as a Windows Service, which does not retain stderr and does not have a standard way to reconfigure it.
Potential Solution
Allow configuring a log file for any chunkio logs.
Alternatives Considered
Since the problem really shines as a Windows Service, this could be solved on Windows specifically by using the SetStdHandle function in the Win32 Console API. However, with all the work that would need to be done to allow configuration of this file just for Windows, you might as well do the implementation in a cross platform manner that may still benefit users on other platforms even if they have other escape hatches.
Additional Context
This issue was discussed in person at the Fluent Bit Developer's Meeting on July 12,2023.