Skip to main content

🌈 A flexible and minimal Python logging utility that adds colorful, readable log output to your terminal.

Project description

🌈 A flexible and minimal Python logging utility that adds colorful, readable log output to your terminal.

Installation

pip install rainbow_logging

Usage

To import both the rainbow_logging and the basic logging module, you can use the following import statements:

from rainbow_logging import LoggingConfig, Timezone, verify
import logging

LoggingConfig is a class that configures how logging output will be displayed. It can be used as shown below:

LoggingConfig.set_level(LoggingConfig.DEBUG).thread_name(True).traceback(False).asctime(True).finish(Timezone.Asia.Seoul)
  • LoggingConfig

    • levelname: If set to True, the logging level will be displayed. If False, it will be omitted.
    • asctime: If set to True, timestamp information will be included. If False, it will be omitted.
    • thread_name: If set to True, it will display each thread individually in a multi-threaded environment. If False, output will be the same across threads.
    • set_level: Determines from which level logs will be displayed. The following values can be used: LoggingConfig.DEBUG, LoggingConfig.INFO, LoggingInfo.WARNING, LoggingInfo.ERROR, LoggingInfo.CRITICAL
    • traceback: If True, traceback information will be displayed when a CRITICAL level log occurs.
    • save_file: If a filename is provided, logs will be saved to the file in addition to being output to stdout.
    • finish: Takes a Timezone as an argument and completes all configurations. (This must be called at the end for all settings to be applied.)
  • Timezone

    • This class is used as an argument for LoggingConfig, for example: Timezone.America.Cambridge_Bay

Example

from rainbow_logging import LoggingConfig, Timezone, verify
import logging

if __name__ == '__main__':
    LoggingConfig.set_level(LoggingConfig.DEBUG).thread_name(True).traceback(False).asctime(True).finish(Timezone.Asia.Seoul)
    logging.debug('This message is a log message.')
    logging.info('This message is a log message.')
    logging.warning('This message is a log message.')
    logging.error('This message is a log message.')
    logging.critical('This message is a log message.')

    verify("1 > 2")

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

rainbow_logging-0.0.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rainbow_logging-0.0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file rainbow_logging-0.0.1.tar.gz.

File metadata

  • Download URL: rainbow_logging-0.0.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for rainbow_logging-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3a0bb7b38be4f11a51e7b363a8be63d3c355c50f64bffb57721957131ed1fe6c
MD5 c89703691934bbf175957ee52fe61392
BLAKE2b-256 0de19a756e94f282d2dc808aad4e7e7e408b1684189962b343dcca97216149a4

See more details on using hashes here.

File details

Details for the file rainbow_logging-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rainbow_logging-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 051ed9685d5e660edd30a7f118803068375bd6d1650213cb1d5a7b8b21a5adae
MD5 7ef85ee4d72069b487079f03aa1b2ab2
BLAKE2b-256 1fcf0475ac2871eef41cdc481556acc1aeab8f5361fa28b3170d44b443efc66c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page