Skip to main content

Opinionated JSON logger

Project description

Trustpilot Logging

Build Status Latest Version Python Support

Opinionated json logging module used by Trustpilot, ( based on python-json-logger by madzak )

Installation

Install the package from PyPI using pip:

pip install trustpilot-logging

Usage

import trustpilot_json_logging
logging = trustpilot_json_logging.setup_logging()

logging.warning("i'm alive")

# outputs
# {"message": "i'm alive", "Module": "root", "Severity": "INFO"}

Advanced Usage

import trustpilot_json_logging
logging = trustpilot_json_logging.setup_logging("INFO", sys.stderr, ignore={"elasticsearch":"WARNING"})

logging.info({
    "message": "i just arrived",
    "age": 32,
    "location": "north pole"
})

# outputs
# {"message": "i just arrived", "age": 32, "location": "north pole", "Module": "root", "Severity": "INFO"}

Publish new version

To publish a new version:

  1. Make pr with
    1. your changes
    2. good linting: black . should be happy
    3. bump semantic version
  2. get pr reviewed
  3. merge to master
  4. pull master locally and run poetry publish with the TP pypi credentials

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

trustpilot-json-logging-1.0.12.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

trustpilot_json_logging-1.0.12-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

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