Skip to main content

🖥 Consoly

Elegant Console Logger for Python

MIT

Installation

From PyPI

pip install consoly

From Github

pip install git+https://github.com/OAlienO/consoly.git

Getting Started

from consoly import consoly

consoly.critical('Bomb!!')
consoly.error('Oh shit...')
consoly.warning('Chill')
consoly.info('Just some information')
consoly.debug('Fuck bugs')
from consoly import consoly

consoly.level = consoly.DEBUG
consoly.defaults = { 'badge': True, 'time': True }

consoly.critical('Bomb!!')
consoly.error('Oh shit...')
consoly.warning('Chill')
consoly.info('Just some information')
consoly.debug('Fuck bugs')

Document

type of levels

type level alias
critical 50 consoly.CRITICAL
error 40 consoly.ERROR
warning 30 consoly.WARNING
info 20 consoly.INFO
debug 10 consoly.DEBUG

custom type of level

consoly.types['success'] = {
    'level': 25,
    'color': Color.green,
    'icon': '✔'
}
consoly.level = consoly.SUCCESS
consoly.success('it works')

Consoly

default instance consoly is created by Consoly(FancyFormatter())

consoly.level

default to 0 ( print every messages )

consoly.level = consoly.ERROR

consoly.defaults

default to {}

this is the default options pass to formatter

consoly.defaults = { 'badge': True }

consoly.types

see type of levels

consoly.formatter

see Formatter

Formatter

default formatter is FancyFormatter

FancyFormatter

option for FancyFormatter

# set option default
consoly.defaults = { 'badge': True, 'time': True, 'short': True }
consoly.debug('hello')

# set option directly
consoly.debug('hello', badge = True, time = True, short = True)

set output file ( default is sys.stdout )

consoly.formatter.file = open('service.log', 'w')

custom formatter

from consoly import Formatter

class MyFormatter(Formatter):
    def format(self, text, typeData, formatData):
        name  = typeData['name']
        color = typeData['color']
        bold  = formatData.get('bold', False)
        if bold: color = color.bold
        self.write(f'{color.paint(name)} - {text}')

consoly.formatter = MyFormatter()

For example consoly.error('test', testOption = 10)

text will be test
typeData will be
{
    'name': 'error',
    'level': 40,
    'color': Color.red,
    'icon': '✖'
}
formatData will be
{
    'testOption': 10
}

Release files for consoly 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for consoly 0.0.1
File Size Uploaded
consoly-0.0.1.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for consoly 0.0.1
File Interpreter ABI Platform
consoly-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / consoly-0.0.1.tar.gz

Download URL consoly-0.0.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
67c6389b5c9979d43189a6fbdf5cdc232b4e03d3893015dcb0bf858ebe7759a3
BLAKE2b-256 checksum
How to use checksums
0622b334d34af8ede360f0b14a9413208edc13a3720dd19ee5b51ef607da74fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / consoly-0.0.1-py3-none-any.whl

Download URL consoly-0.0.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72969625720ac6ad519ed65973ae0b3db0a8e30bac3d004e4c6e24decf755951
BLAKE2b-256 checksum
How to use checksums
f8406234ca124e259bd6dd66c72fd8720da81d0dc57997eaf45d35c02e479eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page