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

Logs from not-root loggers created before applying plugin are not being sent #44

Open
sergeyphi opened this issue Jan 30, 2023 · 0 comments

Comments

@sergeyphi
Copy link

sergeyphi commented Jan 30, 2023

In my case, I create loggers for each module on init. Then as soon as remote logging endpoint auth is available I apply remote plugin. But the logs from loggers created before that moment are not being sent:

log.enableAll();
const loggerTwo = log.getLogger('module-two');
// ...

// auth is available, applying remote plugin:
remote.apply(log, options);

log.debug('this message will be sent to remote`);
loggerTwo.debug('this message will NOT be sent to remote`);

And there is no way to apply remote plugin to module-two logger separately:

remote.apply(log.getLogger('module-two'), options); // will fail

Since .apply() is expecting root logger and will throw: Argument is not a root loglevel object error.

Any help is appreciated!

@sergeyphi sergeyphi changed the title Plugin is not applied to not-root loggers Logs from not-root loggers created before applying plugin are not being sent Jan 30, 2023
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

1 participant