pflogf

Logging formatter for fnndsc/pf* family, inspired by pfmisc.debug


Keywords
logging, color
License
MIT
Install
pip install pflogf==0.0.3

Documentation

pflogf

PyPI version

Colorful logging formatter for fnndsc/pf* family. Its hardcoded format displays displays time, hostname, and calling function. The various logging levels (debug, info, warn, error, critical) are printed in different colors.

pflogf aims to replace pfmisc/debug.py using the standard Python logging module.

Screenshots

The output is intended for full-screen TTY output.

full screen

It tries to detect when not enough colums are available to display full information.

half screen

Examples

import logging
from pflogf import FnndscLogFormatter

logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
handler.setFormatter(FnndscLogFormatter())
logger.addHandler(handler)

logger.setLevel(logging.DEBUG)
logger.debug('debug me as I am full of bugs')
logger.info('an informative statement')
logger.warning('you\'ll probably ignore this warning')
logger.error('error, problem exists between keyboard and chair')
logger.critical('critical failure, haha jk')