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
logtron-0.1.13.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file logtron-0.1.13.tar.gz
.
File metadata
- Download URL: logtron-0.1.13.tar.gz
- Upload date:
- Size: 9.2 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 | aae283e0c2e08a8ca4fc7136745303e8314b95567f58f65501f6e2125d68edf6 |
|
MD5 | f43982adad8f509fe32a412df3783c8f |
|
BLAKE2b-256 | 5a7ca024c766068af83a56b5fff94b8ccfa13866a9049fd3e1f3f8aa009b4050 |
File details
Details for the file logtron-0.1.13-py2.py3-none-any.whl
.
File metadata
- Download URL: logtron-0.1.13-py2.py3-none-any.whl
- Upload date:
- Size: 10.4 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 | e436b77ea862a8fa6a6273425841e503c1cc858efde2b3c317d50348fce7ce44 |
|
MD5 | dab1521b2cf79b810ba92d2db3a18d25 |
|
BLAKE2b-256 | ae3c94c94d9718bcfc07729e04a611846b306e63fe2e6ea34b016574a42d28c9 |