neatlog: A neat logging configuration¶
This package provides an easy and transparent way of customizing the builtin logging. Just import the module and enjoy the difference.
Table of Contents
Quick start¶
Install by typing
pip install neatlog
and simply import neatlog in your program and use logging as usually:
import logging
import neatlog
logging.critical("something critical")
logging.error("some error")
logging.warning("some warning")
Or use the log
decorator to log function calls:
import logging
from time import sleep
from neatlog import log, set_log_level
set_log_level(logging.DEBUG)
@log
def foo(x):
sleep(1)
logging.info(f"in foo, arg: {x}")
foo(2)
Why not use the built in logging?¶
In fact, neatlog uses Python’s built in logging, so let’s rephrase the question: “Why use neatlog on top of logging?”
If you have ever found yourself looking up how to configure the logging format
for the 195th time in order to get a more appealing or more parsable output, or
if copying the basic_config
command from another project over to the new one,
then you may appreciate to get a neat and very readable logging setup by simply
importing neatlog.
At the same time, neatlog is totally transparent, meaning it merely provides, configures, adds and removes handlers and formatters. So you can combine neatlog’s configuration with your own handlers or access the handlers and formatters to fiddle around with them.
How to Contribute¶
If you find a bug, want to propose a feature or need help getting this package to work with your data on your system, please don’t hesitate to file an issue or write an email. Merge requests are also much appreciated!