Anatomy of POST requests sent to the HTTP host - hacktlib/py-async-http-logging GitHub Wiki

Log messages are sent to your HTTP host in a POST request. Logs are included in the request body. Body data is a JSON array containing one or more mappings following this anatomy:

[
    {
        "type": "async-http-logging",
        "created": 123456789.0,
        "relative_created": 123.0,
        "message": "Message logged, as in logger.info('message')",
        "level": {
            "number": 20,
            "name": "INFO"
        },
        "sourcecode": {
            "pathname": "/path/to/your/python/script.py",
            "function": "function_name",
            "line": 123
        },
        "process": {
            "id": 1234,
            "name": "MainProcess"
        },
        "thread": {
            "id": 1234567890,
            "name": "MainThread"
        }
    }
]

Extra argument

When an extra argument is passed to the Logger object[extra arg]...

logger.info('Some message', extra={'foo': 'bar'})

...the mapping is adjusted with an additional extra key, as displayed below:

[
    {
        "type": "async-http-logging",
        "created": 123456789.0,
        ...
        ...
        "extra": {
            "foo": "bar"
        }
    }
]

Footnotes

[extra arg] Please refer to Logging extra fields in the documentation

⚠️ **GitHub.com Fallback** ⚠️