Closed xkr47 closed 1 year ago
When being dropped, the logger handle flushes all not yet written log lines from the buffers to the target. If you use std::mem::forget(handle)
, drop() will never be called and thus flushing will not happen when the program terminates. You then run the risk that the last few log lines do not appear.
Regarding keeping the logger handle alive — you could add to the documentation¹ that you can also use:
This lets the handle stay alive until the end of the program. So one doesn't need to keep the handle stored anywhere.
¹) at least in
Logger::start()
russtdoc and in https://docs.rs/flexi_logger/latest/flexi_logger/error_info/index.html#write