Outputs
Outputs define where captured events are sent. Pass any output class toobserve() via the output parameter.
Stdout
Prints a one-line summary to the terminal after every call.SQLite
Persists every event to a local SQLite.db file. File is created automatically if it doesn’t exist.
Logger
Writes structured JSON to Python’s standardlogging module. In production this automatically routes to CloudWatch, Datadog, GCP Logging, Grafana Loki, or whatever log aggregator is already configured. Zero new infra.
HTTP
POSTs every event as JSON to any HTTP endpoint you control.OpenTelemetry (OTEL)
Export your traces natively to Datadog, Grafana, Jaeger, or any other OpenTelemetry compatible observability platform.- Seamless integration with existing APM setups
- Distributed tracing out of the box
- Zero-latency background export
Multi
Writes to multiple outputs at once.Auto Detection
When no output is specified, TokenSense reads the environment and picks a sensible default:
Reads from:
ENV, ENVIRONMENT, APP_ENV — whichever is set first.
Override at any time by passing output= explicitly.
