Skip to main content

LINZ standard Logging format

Project description

Python LINZ Logger

GitHub Actions Status Kodiak Dependabot Status License Conventional Commits Code Style

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


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.11.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

linz_logger-0.11.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file linz_logger-0.11.0.tar.gz.

File metadata

  • Download URL: linz_logger-0.11.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for linz_logger-0.11.0.tar.gz
Algorithm Hash digest
SHA256 7454e18f613b5aafbb38cad1478d48eab15bacd4d3fe8bb70fcc55f4ea139a6b
MD5 2f84589ee71bd6d5620b2dc4a4736031
BLAKE2b-256 7129de1a703fae473d8014d1770e86e7f6b46b9b02dbe84ea6c2dc4bf1476902

See more details on using hashes here.

File details

Details for the file linz_logger-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: linz_logger-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for linz_logger-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e8ef3f85a77e9506728a022e7b9b6b835c32a7d784ee8d78b6bb28755cc264a
MD5 26ef8015917ffe26226ef591628df9b5
BLAKE2b-256 7ab5310ff8b62f7607d8b127ebe222acfc1394aca0b5f490832903b70672fa7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page