A simple logging library with JSON log formatting
Project description
Logtron
Logtron is a simple logging library with JSON log formatting.
>>> import logtron
>>> logger = logtron.autodiscover()
>>> logger.info("hello world")
{"timestamp": 1598900664859, "message": "hello world", "name": "root", "level": 20, "context": {}, "extra": {}}
>>> logger.info("extra args", extra={"foo": "bar", "count": 7})
{"timestamp": 1598900667704, "message": "extra args", "name": "root", "level": 20, "context": {}, "extra": {"foo": "bar", "count": 7}}
>>>
Or
>>> import logtron
>>> logtron.autodiscover() # Only needs to run once somewhere to configure the root logger
<RootLogger root (INFO)>
>>>
>>> import logging
>>> logger = logging.getLogger()
>>> logger.info("hello world")
{"timestamp": 1598900735699, "message": "hello world", "name": "root", "level": 20, "context": {}, "extra": {}}
>>> logger.info("extra args", extra={"foo": "bar", "count": 7})
{"timestamp": 1598900757238, "message": "extra args", "name": "root", "level": 20, "context": {}, "extra": {"foo": "bar", "count": 7}}
>>>
Logtron allows you to skip all the usual boilerplate when configuring python logging.
Logtron will default to a console JSON log formatter that is compatible with popular log aggregators such as Logstash, Fluent Bit, or AWS CloudWatch Logs.
Installing Logtron and Supported Versions
Logtron is available on PyPI:
$ python -m pip install logtron
Logtron officially supports Python 2.7 & 3.5+.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logtron-0.1.15.tar.gz.
File metadata
- Download URL: logtron-0.1.15.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d0a5a7fe37981aa0bfc72c7a3648b58bdbded81645d68d92762334974e03667
|
|
| MD5 |
c9542fc192228a5588e4f3c5c48d9687
|
|
| BLAKE2b-256 |
1a3a9dbd1451d945110f9ff54ad9ee3c715dde2f00e914eb4af0780b89cfb1ed
|
File details
Details for the file logtron-0.1.15-py2.py3-none-any.whl.
File metadata
- Download URL: logtron-0.1.15-py2.py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce4dce9fe93a42be8380ed90e164ddc8d6f00971116876f2d4c3baddfee2b642
|
|
| MD5 |
27d0c2d571f71343f6efcf97c12069ff
|
|
| BLAKE2b-256 |
24b8e74ca9fcfbd6900724a329c46d535fa4967bbb03b1140cf2a92425993318
|