neatlog
Very simple but fancy looking logging module. It's based on python's standard logging module and uses the colorlog module written by Sam Clements (@borntyping on GitHub) and colorama by Jonathan Hartley (@tartley on GitHub) to output colored logs to the console on Mac, Linux and Windows.
If you quickly want to create informative and easy to read logs with some flexibility this is the right module. If you want lots for flexibility this is not the right module.
import neatlog
LOG = neatlog._Logger('test')
LOG.debug('debug {0}'.format("something"))
LOG.info('info')
LOG.warning('warning')
LOG.error('error')
LOG.critical('critical')
LOG.exception("exception")
LOG.setFilePath("/Users/local/Desktop/test.log")
LOG.enableFileHandler(True)
Input levelname as a string or use the standard values defined by the python 'logging' module
LOG.setLevel('debug')
LOG.setLevel('info')
LOG.setLevel('warning')
LOG.setLevel('error')
LOG.setLevel('critical')
LOG.setLevel(20)
This settings is to change how much info is included in each log. The consolehandler verbosity default is 10. The filehandler always has maximum verbosity so it prints as much info as possible to the logfile. You can however change the verbosity of the console handler
LOG.setVerbosity(0) # Level, message
LOG.setVerbosity(10) # Level, function, message
LOG.setVerbosity(20) # Level, file, function, message
LOG.setVerbosity(30) # Level, file, function, line, message
LOG.info("something")
Feel free to suggest stuff or point out bugs etc..
-- CHANGELOG The format is based on Keep a Changelog
- Fixes a bug that caused the fileHandler to log the wrong parent function name
- FileHandler now has same indentation style as consoleHandler for better readability
- Fixed bug messing with stacktrace, which displayed wrong linenumbers, file- and functionnames in log messages
- To fix the bug mentioned above, I unfortunately had to remove the functionality to pass a tuple into the log functions. Writing custom functions to for stacktracing correctly got too messy and the payoff isn't big enough. Sorry 'bout that.