Skip to main content

Encode logs to JSON format

Project description

KODE Logger

Usage example

import kode_logger


logger = kode_logger.create_json('my-context', tags=['tag1', 'tag2'], extra={'common_variable': 'value'})
logger.warning('hello', extra={
    'my_variable': 'value'
})

Example of produced log message

{
  "@timestamp": "2019-10-22T11:11:42.133Z",
  "message": "hello",
  "level": "WARNING",
  "pid": 40110,
  "context": "my-context",
  "tags": ["tag1", "tag2"],
  "extra": {
    "func_name": "example",
    "line": 5,
    "path": "file.py",
    "process_name": "MainProcess",
    "thread_name": "MainThread",
    "common_variable": "value",
    "my_variable": "value"
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kode-logger, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size kode_logger-1.0.4-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size kode_logger-1.0.4.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page