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.6.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file logtron-0.1.6.tar.gz
.
File metadata
- Download URL: logtron-0.1.6.tar.gz
- Upload date:
- Size: 7.6 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 | 33dd49692f2a4e9070f5de164314338729b7f32caa04dc0fa97a2bf426f18c77 |
|
MD5 | 50f1e87d6dbdb5619a5ee2adc3dceb83 |
|
BLAKE2b-256 | b2440815e46a7e7fbee104034c0fbd50b108ec72a8067e7b3a579bc4bf3b36fe |
File details
Details for the file logtron-0.1.6-py2.py3-none-any.whl
.
File metadata
- Download URL: logtron-0.1.6-py2.py3-none-any.whl
- Upload date:
- Size: 8.8 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 | 4a39fd5cff29678d426b500d7f7a2bc0eff2777f6a716b99b13da8b9c6c7957c |
|
MD5 | 4b81271348e9b4f96d74f26ba6b894af |
|
BLAKE2b-256 | 58746cf919c6451ca8547a347e9490ffdec1aea05aba5689d266a33402613331 |