Python Forum

Full Version: Logging tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

The web contains a tremendous amount of "in-depth guide to Python logging". It therefore becomes very easy to find one part of the information about logging: how to configure it. But how to use it?

I do not ask how to use getLogger and similar functions, but where to place them, and how to choose the level on a software engineering side. While info, error, and critical look easy to place (but are they?), I have no idea what are the best practices regarding debug. Shall I add one at the beginning and end of every method? Every second line?

I'm just looking for a guide on this matter, being a PEP, recommendations from a large project, or any document from a quality source.

Thanks in advance!
Duna
A very good introduction to python's standard library modules is usually Doug Hellmann's pymotw3 series. Check it first.
Thanks Gribouillis for the link. Unfortunately, this documentation is pretty similar to what I can see somewhere else. It explains very well how to configure and use it, but not when and where to use it.

I guess what I'm looking for is closer to a best practice than really a tutorial.