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

Can I have multiple loggers? #1127

Open
mdelmans opened this issue Apr 25, 2024 · 2 comments
Open

Can I have multiple loggers? #1127

mdelmans opened this issue Apr 25, 2024 · 2 comments
Labels
question Further information is requested

Comments

@mdelmans
Copy link

I'm running an async server and I want users to chose which sinks to use for logging, so I need to customise logger before passing it to an async function.

Is it possible to create multiple loguru._logger.Logger instances so there is no cross-talk between them? Is there a better approach?

@Delgan
Copy link
Owner

Delgan commented May 2, 2024

One way would be to use bind() but that requires the added sink to have a filter based on the bounded name.

Maybe you can use this workaround to create inepependent loggers until I implement a new() method: Creating independent loggers with separate set of handlers.

@Delgan Delgan added the question Further information is requested label May 2, 2024
@mdelmans
Copy link
Author

mdelmans commented May 2, 2024

Thanks, I think this should work.

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

No branches or pull requests

2 participants