4 ms·
Logging is the worst kind of Python standard-library module: too clunky and ugly to be pleasant, but not bad enough to justify the breakage of using a third-par
by pjscott 14y ago
Logging is the worst kind of Python standard-library module: too clunky and ugly to be pleasant, but not bad enough to justify the breakage of using a third-party alternative. In comparison, urllib and urllib2 are great, because they suck so much that everybody just uses requests instead.
</rant>
- peter_l_downs 14y agoI totally agree with you. In fact, that's why I wrote an alternative logging library — to try to do the same thing for `logging` that `requests` did for `urllib`. Feel free to check it out: https://github.com/peterldowns/lggr https://github.com/peterldowns/lggr EDIT: Forgot to mention that although I haven't worked on this for a couple of months, I'm about to revisit it and would love to have other contributors. Please, fork this and make it better!
- dudus 14y agoIf you totally agree with him you wouldn't have written your own library.
- peter_l_downs 14y agoSlightly pedantic, but you're correct. I meant that he's right that the standard logging library sucks. I guess I think it sucks more than he does, though, becuase I did write my own library.
- andreasvc 14y agoHow can urllib be great when it sucks?
- est 14y agorequests requires urllib3, which depends on httplib and urllib. I'd secretly hope requests was built on top of socket directly.
- pjscott 14y agoIf anybody wants to do this, the HTTP protocol parser from node.js is really good, and deliberately easy to embed: https://github.com/joyent/http-parser https://github.com/joyent/http-parser
- njharman 14y agoWhat's so clunky? It scales nicely. Simplest thing just works, when you need more, you can learn just enough to get what you want. import logging as log log.warning("groupthink says it sucks") log.error("omg wtf, so hard!!!") log.basicConfig(filename='ignorance.log',level=log.DEBUG) log.debug("rtfm", exc_info=True) And so on; formatting, handlers, multiple loggers, config files, proper lib logging, etc. All very pluggable and extendable, but only if you need it. There's a basic tutorial, advanced tutorial and a cookbook. http://docs.python.org/library/logging.html http://docs.python.org/library/logging.html
- damncabbage 14y agoI'm not sure taking a shot at the parent poster is terribly nice, even if you're doing it as part of a code example. (Groupthink, ignorance, RTFM? Seriously?)
- njharman 14y agoThat's a shot at the many people posting here and elsewhere about how "horrible" logging module is. Most of whom I suspect (cause it ain't that bad) are jumping on the hatewagon without actual investigation of the module.