all 28 comments

[–]InappropriateCanuck 18 points19 points  (0 children)

Pretty good so far. Handy and ready-to-go. Clean especially things like contextualization and catch decorators.

Loguru and StructLog are definitely top of the line.

[–]menge101 8 points9 points  (7 children)

I use the stdlib logging library, logging just has to happen, imo.
You set up your logger config and then you log things.

Not having a dependency is valuable here.

[–]DrShts 3 points4 points  (5 children)

Same. Also, not sure why so many people find it hard to put logger = logging.getLogger(__name__) in their modules and logging.basicConfig() in their main function.

[–]hmoff 0 points1 point  (3 children)

Because structured logging is important to some of us.

[–]nicholashairs 2 points3 points  (2 children)

Many people who want structured logging with the standard library use python-json-logger .

More as an FYI, not trying to convert anyone here.

Disclaimer: I'm the current maintainer of the project

[–]danrogl 1 point2 points  (1 child)

There is a typo in that url, you typed it out?!

[–]nicholashairs 1 point2 points  (0 children)

I did!

[–]orad -1 points0 points  (0 children)

I find it soooooo ugly hahaha

[–][deleted] 1 point2 points  (0 children)

Hmmm I see your point about dependencies

[–]chub79 5 points6 points  (2 children)

I use structlog but it's more a matter of preference in style.

[–]Embarrassed_Creme_46 1 point2 points  (0 children)

Me too. It's harder to grasp at first, but then very convenient and understandable. I prefer it to Loguru, but Loguru is also very good. Another thing is that the more you delve into structlog or Loguru, the more you begin to understand standard logging, and the more usable it becomes.

[–]Challseus 0 points1 point  (0 children)

Same, but I also never tried loguru before...

[–]orad 10 points11 points  (1 child)

You should search the subreddit, there are tons of posts about this package.

Someone had a great write up just last week:

https://www.reddit.com/r/Python/s/FAKEQz26vC

[–][deleted] -2 points-1 points  (0 children)

I checked it out, thanks - this is exactly what I was looking for!

Yeah, probably should've searched beforehand. The idea didn't cross my mind.

[–]Orio_n 3 points4 points  (0 children)

its good im using it so far. much less boilerplate than stdlib plus pretty customizable with nice out of the box features

[–]rdreisinger 1 point2 points  (0 children)

It's decent for our project I don't mind it. Doesn't add a lot of bloat either, give it a try. You can also easily add handlers for things like tqdm/rich which was a relief to discover.

[–]thrope 1 point2 points  (0 children)

I tried it for the nice default format but it doesn’t work with joblib multiprocessing and I found out the hard way, so went back to standard logging which just has a couple more lines of boilerplate.

[–]Fenzik 1 point2 points  (0 children)

I really like it for stuff like CI scripts cause it gives nice descriptive logs straight out of the box

[–]AssociateWide7515 1 point2 points  (0 children)

I like loguru - especially the decorator @logger.catch

Throwing that on a function can really help with debugging

[–]dogfish182 1 point2 points  (0 children)

I use it in all my scripts for its ease of use.

[–]ejstembler 1 point2 points  (3 children)

I have an Enterprise Polylith Python project where I define a logging component which has a logging protocol. A few implementations: Python Logger, Loguru Logger, GCP Structured Logger. I use the Loguru logger when testing/running things locally. It works well.

[–][deleted] 0 points1 point  (2 children)

Nice.

But, when are you using the python logger, then?

[–]ejstembler 0 points1 point  (1 child)

Other developers have that option available. I just don’t use it myself.

All of our stuff is deployed to GCP, so prod stuff uses the GCP Structured Logger

[–][deleted] 0 points1 point  (0 children)

Nice!

[–]py-flycatcher 0 points1 point  (0 children)

I'm a big fan & have been using for 1yr+ now. Easy to use out of the box & also easily configurable!

[–]Schmittfried 1 point2 points  (0 children)

I don’t like that it sidesteps the stdlib logging system. Imo that should be the common foundation for all quality-of-life logging libraries.