Appearance
Python (Django, Flask and FastAPI)
Install
sh
pip install simpledatalogssh
# .env
SIMPLEDATALOGS_KEY=sdl_sec_…Until the package is on PyPI, install it from GitHub as shown in the Python SDK page.
Add it
python
import simpledatalogs
sdl = simpledatalogs.init()
sdl.track("signup", {"plan": "pro"}, user_id=42)A background thread sends every 5 seconds; whatever is left goes out when the process exits.
Send your logs
python
# Django: settings.py
import simpledatalogs
simpledatalogs.init()
LOGGING = {
"version": 1,
"handlers": {"simpledatalogs": {"class": "simpledatalogs.SimpleDataLogsHandler", "level": "WARNING"}},
"root": {"handlers": ["simpledatalogs"], "level": "INFO"},
}python
# Flask
import logging
app.logger.addHandler(simpledatalogs.SimpleDataLogsHandler(level=logging.WARNING))For FastAPI, use simpledatalogs.AsyncClient() and await sdl.aclose() in the lifespan.
In the first minute
- Your
track()events within 5 seconds. - Warnings and errors on the Logs tab, with
exception.type,exception.messageandstacktracefor exceptions.
Defaults
| Feature | Default |
|---|---|
| Sending | every 5 s, or at 50 lines; retried until a 202 |
| Queue | memory, at most 10,000 lines or 10 MB; outbox_dir= keeps unsent lines on disk |
| Exit | flushes for up to 5 s |
| Autocapture | none: only what you track and what your loggers emit at the handler's level |
Everything else is in the Python SDK reference.