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.8.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file logtron-0.1.8.tar.gz
.
File metadata
- Download URL: logtron-0.1.8.tar.gz
- Upload date:
- Size: 7.7 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 | 2cb53f41741b24a2ea820f9bd395bc8d72f9e9a00e332b869ecf178cecd6578c |
|
MD5 | c5e4448ef7591cef2c433cd7bcdbae3e |
|
BLAKE2b-256 | 3629cdaf8b031b5e5a214baaccfbc632c9ad1825f2b04cf12f426e287687d64c |
File details
Details for the file logtron-0.1.8-py2.py3-none-any.whl
.
File metadata
- Download URL: logtron-0.1.8-py2.py3-none-any.whl
- Upload date:
- Size: 8.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 | 30bb1e281cfa11e822fb72e07528670e2a78c3fc32fe771b6d23e08b6f46e415 |
|
MD5 | ec70f9be734a17895cbac2e6014e0945 |
|
BLAKE2b-256 | 4ce2b5b73d99acc2224df1ec36b526158dc900f38f56c4d2ec43dfc90c092af8 |