Skip to main content

A colored logs package based on 'colored'

Project description

colored_logs

python_version PyPI download month PyPI version build codecov Codacy Badge DeepSource

Install

pip install colored-logs

or

pip3 install colored-logs

Features

  • Print different types of logs (info, success, fail, warning, error, critical, subtle)
  • Add custom color for each type of log (both foreground and background. Defaults to these colors)
  • Can Provide colors in RGB, HEX, HSV, HSL, or CMYK
  • Mark logs with custom ids (optional, defaults to no id)
  • Show type for every log (optional, defaults to True)
  • Show time of logging for every log (optional, defaults to True)
  • Change logging env to html (defaults to Console. In html it appears like this)
  • Log async task

Usage

import time

from colored_logs.logger import Logger, LogType#, LogEnvironmeent

log = Logger(
    ID='Test-id-1'
    # environment=LogEnvironmeent.HTML,  # Override to print html logs
    # console_line_char_len=90           # Optionally provide how many chars does fir in one consolee line
)

log.info('This is an info log')
time.sleep(0.5)

log.ID='Test-id-2'
log.info('This is an info log with a new id')
log.ID='Test-id-1'
time.sleep(0.5)

log.success('This is a success log')
time.sleep(0.5)
log.warning('This is a warning log')
time.sleep(0.5)
log.error('This is an error log')
time.sleep(0.5)
log.fail('This is a fail log')
time.sleep(0.5)
log.critical('This is a critical log')

time.sleep(1)

log.start_process('This will take a while')
time.sleep(3.5)
log.info('This is an info log while also logging the active process')

time.sleep(3.5)

duration_float_seconds = log.stop_process(
    log_type=LogType.Success,
    values='Successfully finished task'
)

In action

video

Credit

This package was inspired by colored, which is maintained by dslackw

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

colored_logs-0.2.10.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

colored_logs-0.2.10-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file colored_logs-0.2.10.tar.gz.

File metadata

  • Download URL: colored_logs-0.2.10.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

File hashes

Hashes for colored_logs-0.2.10.tar.gz
Algorithm Hash digest
SHA256 60aef246e9f4fcb8aa8821d915af515ed890803bae34981dac2b065b4a1f8b49
MD5 f27f5a25e18ef4036ce48281477728a0
BLAKE2b-256 3ca05a07fda09a452b1764bf5e352d22b7c94a2e5482a1e04782a6284a031c31

See more details on using hashes here.

File details

Details for the file colored_logs-0.2.10-py3-none-any.whl.

File metadata

  • Download URL: colored_logs-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6

File hashes

Hashes for colored_logs-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 49c22c7294827af013abf078bb3098755c93ca6f67aef4f1b45aacdc28828768
MD5 8571f6330703fdf2970274605769afd6
BLAKE2b-256 92ac02a4fd264b6d0abc6dbd25959f0b43b821b97f2bc4863d211d1fc7986169

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