Package to log styled messages on console
Project description
clinlog
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
print_error()
print_warn()
print_info()
print_confirm()
print_norm()
The signature for all print methods are the same:
- message (str): Message to print.
- tag (str): (Optional) Prefix 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. - bold (bool): (Optional)
True
to use bright style to print the message (kind of bold font). By defaultFalse
. - highlight (bool):
True
to use the color on the background and a high contrast color for the message text. - invert_color (bool):
True
to invert font color when highlight flag is on, this will switch between black and white. By defaultFalse
.
Default print tag attributes
error_tag
warn_tag
info_tag
confirm_tag
norm_tag
Code Sample
from clinlog import Logger
# Create the logger
log = Logger()
# Set default error tag
log.error_tag = '[ERROR]: '
# Print error styled message
log.print_error('Unable to access config file', bold=True)
# Print warning highlighted and bold
log.print_warn('The execution will continue with default configuration', None, True, True)
# Confirmation log with provided tag
log.print_confirm('Execution completed', '[SUCCESS]')
Output
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.
Source Distribution
clinlog-0.1.0.tar.gz
(3.0 kB
view hashes)