Open LoipesMas opened 2 years ago
Good suggestion. We indeed have some redundant code for logging.
Better yet, we should develop a general logger struct that allows setting how much log files to keep (see server's logger) and make this new general logger reside in shared
crate so that every part of the project will just use it.
I'd suggest using a logging crate, to reduce boilerplate code. Preferably one that uses log facade, such as env_logger or flexi_logger. I know
flexi_logger
can be customized a lot (formatting, where to write, mirroring to file and stdout), but other crates probably also have such functionalities.This would also handle logs from libraries that are logging using
log
crate, which currently are being ignored (if there are such crates in your dependencies).