4 ms·
What's wrong with http://docs.python.org/howto/logging.html#logging-basic-tutorial http://docs.python.org/howto/logging.html#logging-basic-tuto... and http://do
by slug 15y ago
What's wrong with http://docs.python.org/howto/logging.html#logging-basic-tutorial http://docs.python.org/howto/logging.html#logging-basic-tuto... and http://docs.python.org/howto/logging-cookbook.html#logging-cookbook http://docs.python.org/howto/logging-cookbook.html#logging-c... coming directly from the library reference http://docs.python.org/library/logging.html http://docs.python.org/library/logging.html ?
- kylemaxwell 15y agoIf you want lots of detail (which, eventually, you should), then those absolutely do a great job. But if you want a quick-and-dirty intro just to get down to business, then this sort of post does a great job. I mean, clearly it's benefited some folks, so it serves some good purpose, right? :)
- slug 15y agoWhat's wrong is giving slightly bad suggestions, like keeping a global 'logger' variable. There's absolutely no need to do that, just use a import logging ; getLogger(__name__) for example. I usually have something like self.logger = logging.getLogger(__name__) on my classes __init__() within project/package (sub)modules .