__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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for python_emit-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 440d8ddc4b887a0004f83377e4f1b24d0818b5241b48ac13fa7d1879b0562206 |
|
MD5 | 8d22443734a695184761e0c2c4e2b87f |
|
BLAKE2b-256 | 1e6c6bff40848b7df748763d205d979f6b8062265a7a34b35cca4bb688a74a90 |