fern icon indicating copy to clipboard operation
fern copied to clipboard

Change log file at runtime

Open SadiinsoSnowfall opened this issue 3 years ago • 1 comments

Hi, Is it possible to change the log file(s) (specified using the chain(...) function on the logger builder) at runtime ? I have looked at the issue #76 (A way to change log level in runtime?) but I don't think that the proposed solution can be applied to this problem.

SadiinsoSnowfall avatar May 30 '21 14:05 SadiinsoSnowfall

There isn't an easy solution to this built in at the moment.

I think this would be a reasonable feature to add to fern.

In the meantime, you could work around this by building a custom Log implementation which keeps track of the file via a global variable, and by passing that into chain with .chain(Box::new(GlobalFileLog) as Box<log::Log>).

daboross avatar May 30 '21 17:05 daboross