Skip to main content

Logging json formatter

Project description

Logging Json Formatter

import logging
from qstd_logger_json_formatter import JsonFormatter, configure

JsonFormatter\
    .set_parse_payload_root_logger('app')\
    .set_formatter(
        'sanic.access',
        lambda record: dict(
            level=record.levelname,
            message=record.message,
            host=record.host,
            request=record.request,
            status=record.status,
            byte=record.byte,
            label=record.name,
            pname=record.processName,
            pid=record.process,
            timestamp=record.asctime
        )
    )

configure(JsonFormatter)

app_logger = logging.getLogger('app')

app_logger.info('Example message', dict(string='string', number=1))

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

qstd_logger_json_formatter-0.1.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file qstd_logger_json_formatter-0.1.1.tar.gz.

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e4d7bb4cfde64276e43af36e838000c2c5145e5305ab2d3b01bc9b6fff2f2f0c
MD5 691d0f0f3c5ff353ddc0ae3f8f2afc83
BLAKE2b-256 a1bd2c4b7d94ff332535c17905cbd9d160c5964fac6550fa639f2dba11920f3b

See more details on using hashes here.

File details

Details for the file qstd_logger_json_formatter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20d0cc5c7a2ea0bbc612f826bdcaf252b33e9b6708c117da1457fa79381a79ad
MD5 7004d6f589becfbb4d9dc0ab83cca554
BLAKE2b-256 974eef45d4243b27d87fe1812e3b871587c04b5aefb62280a5dcd81fc43ea248

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