Skip to main content

Custom logger with colors on terminal

Project description

MWK logger


PyPI
Custom logger with colors on terminal.

mwk_logger_example


Using logger:

pip install mwk-logger

1. Get instance of mwk-logger: (example)

from mwk_logger import MwkLogger

log = MwkLogger(name='mwk',
                file='logger.log',
                stream_level='DEBUG',
                file_level='DEBUG',
                time=True).logger

!!! Remember to add .logger at the end !!!

keyword parameters:

  • name - name of the logger, by default = 'mwk',
  • file - path to file to log into, by default = 'mwk.log',
  • stream_level - logging level for terminal, by default = 'WARNING',
  • file_level - logging level for file, by default = None,
  • time - if timestamp should be added to terminal log, by default = False,

LEVELS: None - no logging (terminal or file) or:
'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'.
If both levels are set to None stream_level is changed to WARNING.
Timestamp is by default added to file logs. One can set if timestamp will be added to terminal logs.

2. Logging:

log.debug('This is a debug message.')
log.info('This is an info message.')
log.warning('This is a warning message.')
log.error('This is an error message!')
log.critical('This is a critical message!!!')
log.exception('This is an exception message!')

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

mwk-logger-1.0.2.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file mwk-logger-1.0.2.tar.gz.

File metadata

  • Download URL: mwk-logger-1.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for mwk-logger-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ceb2f1e9f03dd0e484caec4786b09756619a104844c37293f8fbff362666339b
MD5 74d191984f0f7e9269d0f191174f2a6d
BLAKE2b-256 cbabe8726439de1a9adcb3a15274fa662a0d9b8fc653b249b903493b6044bf88

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