Add built-in support for writing log messages to a file
The logging infrastructure introduced by #145 (closed) automatically emits log messages to the standard streams (stdout or stderr, depending on the log format). It's possible to redirect those messages to a file using the standard redirect operator (>
). When using the structured format, it's also possible to route the messages to a file using pino-tee (or to the syslog using pino-syslog). However, it would be nice to have a built-in way of redirecting the messages to a file for convenience (e.g., --log-file=./antora.log
).
This change will require providing a way configure the log file path and any other settings related to writing a file (e.g., buffer size, sync, etc). It will also require enhancing the closeLogger function to register a finalizer to flush and close the logger stream and enhancing the finalizeLogger function to await those finalizers.