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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a036a541ee1b27fec1f663f1246eb94e142626ac27b9b1f2a72b944953e25970
MD5 7dc03c11f92d5885453ade31d27ad9ba
BLAKE2b-256 43cd35899372bd50e95175ae80f9edab0d0b55fc7b790c254078c196203fcefc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6e7c44ca5ae948d53e47af0ed9edea165f59a0fe5a347e5e4590a428f17f7b
MD5 aa43ecaa379fe860bba5e640fc599289
BLAKE2b-256 102c9772e99e4c1b0ceca9cbd5435d610a0ed214be64fac23bd391e0d472aaab

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