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({"country": "NZ"}) # remove_contextvars(["country"]) to remove a key
get_log().error('Hello World', key="value")
# {"key": "value", "level": 50, "time": 1601555605017, "v": 1, "pid": 311800, "id": "01G9XAA1MCMX2K9NZN9GJJHN71", "msg": "Hello World", "hostname": "Ubuntu1", "country": "NZ"}
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.9.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for linz_logger-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31cd8ea27fbf79330727b10f3fae242afc59a7399833c4ff0cb3392869f616c0 |
|
MD5 | 55d31bec2bc1623c89298b6392538aac |
|
BLAKE2b-256 | 3cf7e27e9f1c1d949bc85abffc88a075e33d8309ea8ef8ef79f09d0636f3a688 |