Collecting logs from Python applications
The LogDoc Python SDK with support for the standard logging module. Compatible with Django, Flask, FastAPI and other frameworks.
Terminal — Installation
$ pip install logdoc-python
app.py — Integration
import logging
from logdoc import LogDocHandler
handler = LogDocHandler(
host='logdoc-server',
port=12345
)
handler.setLevel(logging.DEBUG)
logger = logging.getLogger('myapp')
logger.addHandler(handler)
logger.info('Application started',
extra={'service': 'payment'})
Highlights
•Asynchronous sending via asyncio for minimal performance impact
•Automatic context capture: traceback, module name, line number
•Structured logging support with arbitrary fields