Skip to main content

A simple logging package that helps you log colorized messages in Windows console.

Project description

log21

A simple logging package that helps you log colorized messages in Windows console and other operating systems.

Install

To install log21 you can simply use the pip install log21 command:

python -m pip install log21

Or you can clone the repository and run:

python setup.py install

Examples:

from log21 import get_logger, get_colors

logger = get_logger()

logger.warning(get_colors('light red', 'background-white'), 'careful!')
# [21:21:21] [warning] Be careful!

Example1


import log21

logger = log21.get_logger(name='Logger21', level=log21.DEBUG, show_level=False)

logger.debug(log21.get_color('blue') + 'Here we are!')
# [21:21:21] Here we are!

Example2


from log21 import ColorizingStreamHandler, Logger, ERROR

logger = Logger('MyLogger')
streamHandler = ColorizingStreamHandler()
logger.addHandler(streamHandler)

logger.log(ERROR, '%sAn', '%serror', '%soccurred!', args=('\u001b[31m', '\x1b[91m', '\033[31m'))
# An error occurred!

Example3

About

Author: CodeWriter21 (Mehrad Pooryoussof)

GitHub: MPCodeWriter21

Telegram Channel: @CodeWriter21

Aparat Channel: CodeWriter21

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

log21-1.4.1.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

log21-1.4.1-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

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