Skip to main content

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:

Screenshot

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nicelog-0.1.4.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file nicelog-0.1.4.tar.gz.

File metadata

  • Download URL: nicelog-0.1.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nicelog-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a7de148c7ce6bc7de2147b87680f7377bc8cf55bbc924f20a9e5a7042724e1e8
MD5 1b6fbdfb5f10e1018fdcdc19c795eff7
BLAKE2b-256 e5c639243369b8102710810b9c77b30cdd60ba123db003fb611da77b88c81965

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page