sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
3.12k stars 193 forks source link

Fix tag error in logs, remove main logger #1043

Closed Keksoj closed 11 months ago

Keksoj commented 11 months ago

Two loggers co-existed until today, without much utility that @Wonshtrum and I could appreciate. We chose to harmonize logging throughout the whole codebase, and to take RUST_LOG into account anywhere we set up a logger.

This PR fixes a bug brought by commit https://github.com/sozu-proxy/sozu/commit/3a4e4fd93d5451c43f822348e933af1894a2e917, which caused the default logger to be used instead of the tuned one. That was because the commit brings a function to call a debug! macro that calls a static TAG before the logger is initialized, which forces the logger to instantiate with a default tag "SOZU" and can not update it. The bug is fixed by rearranging the code to prevent the early logging, and with a warning comment. The best would be to add a panic! in the code if some developer were to call a logging macro before a Logger is initialized.