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+.
Release files for logtron 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logtron-0.1.15.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logtron-0.1.15-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 20.3 kB
Release files / logtron-0.1.15.tar.gz
| Download URL | logtron-0.1.15.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d0a5a7fe37981aa0bfc72c7a3648b58bdbded81645d68d92762334974e03667
|
|
BLAKE2b-256 checksum How to use checksums |
1a3a9dbd1451d945110f9ff54ad9ee3c715dde2f00e914eb4af0780b89cfb1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp
|
Release files / logtron-0.1.15-py2.py3-none-any.whl
| Download URL | logtron-0.1.15-py2.py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ce4dce9fe93a42be8380ed90e164ddc8d6f00971116876f2d4c3baddfee2b642
|
|
BLAKE2b-256 checksum How to use checksums |
24b8e74ca9fcfbd6900724a329c46d535fa4967bbb03b1140cf2a92425993318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.0 Linux/4.15.0-1077-gcp
|