Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
logging: use tracing for log output, and output to stderr
- Replace `structured_logger` with `tracing-subscribers` for log output. - Add stderr logging, configurable with the --verbose flag, and the RUST_LOG environment variable. The former changes the default log level to DEBUG and makes print format more verbose, the latter adjusts the log level. Previously, we were using `log` to produce logs, and `structured_logger` to put them in a file. For debugging, I want configurable logging to stderr; however, `structured_logger` does not allow different outputs to have different formats or log levels. We begin to use the `tracing` library as well as `log` for the rule engine in PR conjure-cp#393 due to its better multi-threading support. `trace_subscriber::fmt`, the `tracing` log writer used in this patch, automatically intercepts `log` messages. Thus, the logger can now see messages from both systems, instead of just `log`. Long term I believe that `tracing` will be a better choice than `log` and should be used everywhere; however, for now, supporting both in our log output is sensible.
- Loading branch information