Set LOGURU_AUTOINIT to False
See original GitHub issueI don’t mind having an option to auto-init the sinks, but have it set to True
by default seems off to me. As a novice user of the library i would think that i don’t have any sinks set up at the start therefore calling the .info
method would yield nothing. So wouldn’t it be better to set it to False
?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Trapov.
I understand your point, and I think you are absolutely right in theory. It can be quite surprising for a logger to emit output while it has not been explicitly configured.
But Loguru is made to be as easy as possible to use. It should provide reasonable defaults which suit the main use cases. I think being able to use a logger without much configuration is a key for convenience.
This is especially true for logging, you import it because you gonna use it, so why bother with adding a
stderr
sink to each of newly created scripts, while this could be done automatically?This reduces the temptation to use
print()
instead of the logger. In particular, I’m afraid that having to explicitly set an environment variable is a too high entry barrier for the novice user, and not much helpful. I think in most of the cases, a default sink which prints tostderr
something is enjoyable, so it’s an acceptable behavior as long as advanced user can disable it.didn’t think of that, thanks @Delgan