Nice colorful formatters for Python logging.
Project description
Provide formatters to nicely display colorful logging output on the console.
Right now, it contains only one formatter, coloring log lines depending on the log level and adding nice line prefixes containing logger name, but future plans are to add more formatters and allow better ways to customize them.
Example usage
from nicelog.formatters import ColorLineFormatter
import logging
import sys
logger = logging.getLogger('foo')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(ColorLineFormatter())
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.debug('Debug message')
logger.info('Info message')
logger.warning('Warning message')
logger.error('Error message')
logger.critical('Critical message')
Example output
Here it is, in all its glory:
Powerline font support
You can set the HAS_POWERLINE_FONT environment variable to a non-null value in order to tell the formatter to use powerline-style symbols (specifically, the “arrow” thing).
Changelog
v0.1.6
Added support for showing more information:
record date
file name / line number
module / function
v0.1.5
Added support for nicer colors in 256-color mode
Removed dependency from termcolor (now shipping better implementation)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file nicelog-0.1.6.tar.gz
.
File metadata
- Download URL: nicelog-0.1.6.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 032ccbebe93b507e1d17751e99c1508a505a8a18fa153c1571c454a6ff21a9e5 |
|
MD5 | a3f4e3238dc17e06476efcfdbb536681 |
|
BLAKE2b-256 | ba1b28ea95803aeaf2a1c4f546f578b7184a2c9d32d62b1df36344682b7b1acd |