Skip to main content

A minimal, ergonomic python logging wrapper

Project description

ergolog

A minimal, ergonomic python logging wrapper

Intallation

uv add ergolog
# or
pip install ergolog

Basic Usage

from ergolog import eg

eg.debug('debug')
eg.info('info')
eg.warning('warning')
eg.error('error')
eg.critical('critical')
[DEBUG   ] ergo (main.py:3) debug
[INFO    ] ergo (main.py:4) info
[WARNING ] ergo (main.py:5) warning
[ERROR   ] ergo (main.py:6) error
[CRITICAL] ergo (main.py:7) critical

Advanced Usage

Named loggers

from ergolog import eg

eg('test').debug('named logger')
[DEBUG   ] ergo.test (main.py:3) named logger

Tags

from ergolog import eg

with eg.tag('tag1'):
    eg.info('one tag')
    with eg.tag('tag2'):
        eg.info('two tags')
    eg.info('one tag again')
[INFO    ] ergo [tag1] (main.py:4) one tag
[INFO    ] ergo [tag1, tag2] (main.py:6) two tags
[INFO    ] ergo [tag1] (main.py:7) one tag again

Tag Decorator

from ergolog import eg

@eg.tag('inner')
def inner():
    eg.info('test')

@eg.tag('outer')
def outer():
    eg.debug('before')
    inner()

    eg.debug('after')

eg.debug('start')
outer()
eg.debug('end')
[DEBUG   ] ergo (main.py:14) start
[DEBUG   ] ergo [outer] (main.py:9) before
[INFO    ] ergo [outer, inner] (main.py:5) test
[DEBUG   ] ergo [outer] (main.py:12) after

Kwarg Tags

from ergolog import eg

with eg.tag(keyword='tags', comma='multiple'):
    eg.debug('')
    with eg.tag('regular tag'):
        eg.info('')
        with eg.tag(more='keywords'):
            eg.info('')
    eg.debug('')
[DEBUG   ] ergo [keyword=tags, comma=multiple] (main.py:4) 
[INFO    ] ergo [keyword=tags, comma=multiple, regular tag] (main.py:6) 
[INFO    ] ergo [keyword=tags, comma=multiple, regular tag, more=keywords] (main.py:8)
[DEBUG   ] ergo [keyword=tags, comma=multiple] (main.py:9)

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

ergolog-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

ergolog-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file ergolog-0.1.1.tar.gz.

File metadata

  • Download URL: ergolog-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for ergolog-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b07690fa527847fe380875a19e20c6c1701d6db88fc416cd48de9f4a7b90596f
MD5 137e94112e52ded2973efb1fa48d4ab6
BLAKE2b-256 571994671bd52459abeef41a3c03f7f285ec6ae151661f206f1ac2c45fdf3768

See more details on using hashes here.

File details

Details for the file ergolog-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ergolog-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for ergolog-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd0d4ec05fa9e905cbb7b5bee4534451ba1e24fbdb8902dccd05bc3f282cba2
MD5 843194802f4d832a2d4cc7e7d5a37dfe
BLAKE2b-256 9debaa4ccd368fe4b981813f168224326d3320c201e348e29738e4311dfcb500

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