All code at

What's a log?
A 1D list of tuple:
list[tuple[datetime, Level, str]]
[
(datetime(...), 'info', 'GET /accounts/invoice/ -> 200'),
(datetime(...), 'info', 'GET /add-on/complete/ -> 200'),
(datetime(...), 'error', 'Stripe payment failed, insuff...'),
(datetime(...), 'warning', 'POST /payments/42/complete/ -> 400'),
(datetime(...), 'warning', 'POST /payments/37/complete/ -> 400'),
(datetime(...), 'debug', 'Slow query detected SELECT...'),
]
This is what code looked like...
until about 1980
How it should be
A nested structure:
class Log(TypedDict):
start: datetime
end: datetime | None
message: str
attributes: dict[str, Any] | None
children: list[Log] | None
list[Log]
What we proposing here isn't new, but it's still not available to most developers
[
Log(
start=datetime(...),
end=datetime(...),
message='POST /payments/42/complete/ -> 400',
children=[
Log(
start=datetime(...),
message='Stripe payment failed, insuff...',
attributes={'reason': 'insufficent funds', ...}
),
]
)
]
Simple to get started
Built on Open Telemetry
Customised for Python
But Usable with any Language
Traces as Logs, and Metrics
Auto-tracing
Structured Data

Demo...
Integrations with:
Other languages:
Almost any language (via OTel libraries)
examples of Rust, JavaScript, Go

Thank you
Use coupon PYCONPT2024 in Logfire for $600 of free usage
Use by October 31st!
PyCon PT October 2024
By samuelcolvin-pydantic
PyCon PT October 2024
Pydantic Logfire - Why we built it and why you should try it
- 76