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.2.tar.gz (4.6 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.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ergolog-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6a3d0c61bc2ccae1ae781e2964d4238d30aeac80d181957c12ccef2d7cb25d56
MD5 cf807df8f9a243ca3ac80f5ad26ad4b0
BLAKE2b-256 67beddb89d27bb4f3b62560eed9ba256f45f3efd0cf3aabc22e8bb03ee341cce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ergolog-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee0b9c940c9093c96f847e3801f14acc5bc13e94a84df85319325a6848bfa9cd
MD5 ed6198b26225b7c4b9a1fc3977c72975
BLAKE2b-256 99d38cdfc4ae6fd3ee6c8439a451067f6a0ab667f369f005ab4802d3f933541e

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