Giter Site home page Giter Site logo

colored_logs's Introduction

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

colored_logs's People

Contributors

kkristof200 avatar deepsourcebot avatar hiralv avatar ravnicas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.