||3 years ago|
|example||3 years ago|
|sanelogging||3 years ago|
|.gitignore||6 years ago|
|LICENSE||6 years ago|
|MANIFEST||6 years ago|
|Pipfile||3 years ago|
|Pipfile.lock||3 years ago|
|README.md||5 years ago|
|setup.py||3 years ago|
Sane Defaults for Python Logging
The python stdlib
logging module is useful, flexible, and configurable.
However, the maintainers have (quite reasonably) determined that python is
an application runtime and not an application. The default configuration
logging is thus not very useful, and this commonly results in
boilerplate in your own programs.
This is an opinionated module for the 90% case where you just want sane defaults without that boilerplate. (In effect, moving it into PyPI.)
It Also Does Some Other Stuff
There are some convenience methods added, such as
die(c.f. golang and perl).
noticeis aliased to
info, for those who forget that python doesn't have a notice level (i.e. me).
If you set the environment variable
LOG_TO_SYSLOGto something, it will print out your log messages on paper and mail them to you.
If stdout is a tty, log messages will be color-coded using the
from sanelogging import log log.info("starting up!") log.error("something went wrong.") log.die("bailing out") # exits print "no soup for you." # never reached
Jeffrey Paul <firstname.lastname@example.org>
5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2
This code is released into the public domain.