question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set LOGURU_AUTOINIT to False

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Delgancommented, Jan 16, 2019

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 to stderr something is enjoyable, so it’s an acceptable behavior as long as advanced user can disable it.

0reactions
gargolitocommented, May 25, 2019

didn’t think of that, thanks @Delgan

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found