Skip to main content

Package to log styled messages on console

Project description


PyPI version PyPI version

Package to easily log styled messages on console using colorama

Basic usage

Create a Logger object and use his convenient methods to print styled messages in console. You can define a default tag for each kind of message on the Logger instance.

Print style methods

  • confirm()
  • error()
  • warning()
  • info()
  • debug()
  • print()

The signature for all print methods are the same:

  1. message (str): Message to print.
  2. tag (str): (Optional) Prefix tag to print with the message. If None the default tag for this kind of messages is used. An empty string will remove the tag for this print.
  3. bold (bool): (Optional) True to use bright style to print the message (kind of bold font). By default False.
  4. highlight (bool): True to use the color on the background and a high contrast color for the message text.
  5. invert_color (bool): True to invert font color when highlight flag is on, this will switch between black and white. By default False.

Default print tag attributes

When a Logger object is created all default tags are an empty string (no tag)

  • confirm_tag
  • error_tag
  • warn_tag
  • info_tag
  • print_tag

Log level param

You can provide a log level parameter to control the verbosity of the logger, this parameter can be provided during construction or via setter method. By default Logger class takes max verbosity level (debug)

from clinlog import Logger

# Creating a Logger with warining log level
log = Logger(log_level='warning')

# Updating log level via setter
log.log_level = 'debug'

Code Sample

from clinlog import Logger

# Create the logger
log = Logger()

# Set default error tag
log.error_tag = '[ERROR]: '

# Print error styled message
log.error('Unable to access config file', bold=True)

# Print warning highlighted and bold
log.warning('The execution will continue with default configuration', None, True, True)

# Confirmation log with provided tag
log.confirm('Execution completed', '[SUCCESS]')

# Debug log with provided tag
log.debug('DB returned 8 entries for the user', '[DEBUG] ')



Different styes sample


Project details

Download files

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

Files for clinlog, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size clinlog-0.1.1-py3-none-any.whl (4.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size clinlog-0.1.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page