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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0726bb6fc5f1def6069f02db2df894c3786c5efd6932af77fea15b17c0d3b26
MD5 29f665331e598ea339ad339b2f0fdf1f
BLAKE2b-256 404d067aa1086aae82e700afdbc795bcea4ddc78eae248eaa5e8f8adca610b4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qstd_logger_json_formatter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47d7ab3a21996dcc174a7b54de09843f038e6469d369b89f359fb8d5d3d287ea
MD5 50351d81324a18c73b816d68c1e00286
BLAKE2b-256 9c2fc1dc2aaf1598bd1e10d21d6434bb53c1d8f5c29eeac8a8b48eefa84f8608

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