Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change log file at runtime #79

Open
SadiinsoSnowfall opened this issue May 30, 2021 · 1 comment
Open

Change log file at runtime #79

SadiinsoSnowfall opened this issue May 30, 2021 · 1 comment

Comments

@SadiinsoSnowfall
Copy link

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.

@daboross
Copy link
Owner

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>).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants