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

Allow multiple sinks to be used #3

Closed
volfco opened this issue Dec 8, 2018 · 5 comments
Closed

Allow multiple sinks to be used #3

volfco opened this issue Dec 8, 2018 · 5 comments
Labels
enhancement Improvement to an already existing feature

Comments

@volfco
Copy link

volfco commented Dec 8, 2018

I would love if multiple sinks could be used, and not just the one. For me, I'd like to be able to print to stdout/stderr as is the default, while also sending the messages to a custom sink.

I would image it would be easiest to allow logger.start to accept a list that would be called in order.

@Delgan
Copy link
Owner

Delgan commented Dec 9, 2018

You can add as many sinks as you want.

Actually, logger.start(sink) does not start the logger, it starts the sink.
I realize now this is a bit confusing. I should have named the function logger.add() probably?

So, if you do logger.start(custom_sink) and then logger.start(another_sink), every log will be send to both of your sinks.

@volfco
Copy link
Author

volfco commented Dec 9, 2018

Yeah, that's a bit confusing. I would think logger.sink would be most descriptive.

@samuelhwilliams
Copy link

Yep, I think the start method is a bit confusing, too. Maybe logger.add_sink would be a more descriptive alternative?

@Delgan
Copy link
Owner

Delgan commented Dec 9, 2018

Yeah, that's a bit confusing. I would think logger.sink would be most descriptive.

@volfco That would collide with the sink argument itself.

Yep, I think the start method is a bit confusing, too. Maybe logger.add_sink would be a more descriptive alternative?

@samuelhwilliams Thanks for confirming that the method name is confusing, I will change it as soon as possible then!

I prefer not to repeat "sink" in method name, it should be a simple verb.
Once you know Loguru, you know that .add() is for adding a sink, there is little point to affix "sink" again. The issue is when you discover Loguru, you see logger.start() and may be confusing by thinking that this has to do with starting the logger, while it's about the sink.

So I could go with replacing start() / stop() by add() / remove() maybe.

@Delgan
Copy link
Owner

Delgan commented Dec 12, 2018

I released a new version 0.2.2 which deprecate start() and stop() in favor of add() and remove().

I hope this will be less confusing. Thanks for having reporting this. 😉

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

No branches or pull requests

3 participants