Log formatting with colors!
Project description
colorlog.ColoredFormatter is a formatter for use with pythons logging module.
It allows colors to be placed in the format string, which is mostly useful when paired with a StreamHandler that is outputting to a terminal. This is accomplished by added a set of terminal color codes to the record before it is used to format the string.
A usage example, using the default color mapping:
>>> from colorlog import ColoredFormatter >>> formatstring = "%(bg_level)s%(levelname)-8s%(reset)s %(blue)%(message)s" >>> levels = { 'DEBUG': 'cyan', 'INFO': 'green', 'WARNING': 'yellow', 'ERROR': 'red', 'CRITICAL': 'red', } >>> ColoredFormatter(formatstring, reset=True, color_levels=levels)
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
colorlog-0.3.tar.gz
(2.4 kB
view details)
File details
Details for the file colorlog-0.3.tar.gz
.
File metadata
- Download URL: colorlog-0.3.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 341595b0738733e8cc9e12d642af628976c593e882793e909e031b4aa1c3e6cf |
|
MD5 | ddd57d3b174855b4be3cb2ca7cf77120 |
|
BLAKE2b-256 | ed185fb2b09d6d5903f5ff7b8284ef2ca2500091790eda3b62555a6827d0adbb |