LINZ standard Logging format
Project description
Python LINZ Logger
Why?
LINZ has a standard logging format based loosely on the pinojs logging format:
{
"level": 30,
"time": 1571696532994,
"pid": 10671,
"hostname": "Ubuntu1",
"id": "01DQR6KQG0K60TP4T1C4VC5P74",
"msg": "SomeMessage",
"v": 1
}
Usage
pip install --upgrade linz-logger
from os import environ
from linz_logger import get_log, set_level, LogLevel
set_level(LogLevel[environ.get("LOGLEVEL", "WARNING").lower()].value)
set_contextvars({"hostname": environ.get("HOSTNAME")}) # remove_contextvars(["hostname"]) to remove a key
get_log().error('Hello World', key="value")
# {"key": "value", "level": 50, "time": 1601555605017, "v": 1, "pid": 311800, "msg": "Hello World", "hostname": "Ubuntu1"}
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
linz_logger-0.8.0.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for linz_logger-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a169b62fe251c80dce16adaf87285da4ea14405c031dbb56b9b90ebbab51f783 |
|
MD5 | 28b7ddc13692269103a1a0ba2e840755 |
|
BLAKE2b-256 | ccdb0b26a0403abfa6c6633d46dfe32db6d83505341787cb28891363041197e1 |