Drakulix/simplelog.rs

How to update file path of the `WriteLogger` after I call `CombinedLogger::init`?

yaoxin-jing opened this issue · 2 comments

After the global logger is set to WriteLogger with file path /a/b.

Is it possible to update the file path and let the logger log message to another file /a/c?

This is not possible with simplelog out of the box.

You could implement your own SharedLogger, that just wraps a WriteLogger inside an Arc<Mutex<_>>. Then you could exchange the logger in there at runtime to switch logging to a different file.

many thanks, problem resolved