Skip to main content

__emit__: all-in-one logging, tracing and auditing

Project description

Emit

A Python library for understated tracing and structured logging.

TL;DR

# This is the big idea. Now let's use it.
def emit(obj):
    return obj.__emit__()

Logging

from emit import emit, Info, Warning

def frobulate_the_quartzle():
    # This works like you expect, no more logger = logging.getLogger(__name__).
    # just emit and the log will originate from the right place.
    emit(Info("Frobulating the quartzle"))

    if not Quartzle.is_polarized():
        emit(Warning("Quartzle isn't polarized, results may be different than expected."))

Structured Logging

from emit import emit, Context

def push_noins():
    emit(Info("Noins updated."))

def shuffle_lorpizoids():
    emit(Context(current_user="Harry Styles"))

    # The log emitted from this code will include the current_user context.
    push_noins()

Say No To Passing Around Loggers Just To Bind Values

# In `structlog`
log = log.bind(key=value)

# In `emit`
emit(Context(key=value))

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

python-emit-0.0.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

python_emit-0.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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