logfire
logfire copied to clipboard
Use `stack_info` instead of `stack_offset`
Deploying logfire-docs with Â
 Cloudflare Pages
Latest commit: |
82f8c18
|
Status: |  ✅ Deploy successful! |
Preview URL: | https://120562c0.logfire-docs.pages.dev |
Branch Preview URL: | https://user-stack-level-on-openai.logfire-docs.pages.dev |
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
Can you try using this with structlog?
Can you try using this with structlog?
Yeah, it doesn't work. That number 2 doesn't look correct. I'll not merge this.
I've fixed this to also work with structlog. I've explained the + and - I've added. I think we need to refactor the logic we have around those stack_offset
anyway
I've made the following changes, hope it's OK:
- Removed the
stack_info
param fromlogfire_format
. When it needs astacklevel
it can just find the user frame again. This makes things a bit cleaner and also means thatinstrument
doesn't have to recomputestack_info
just for formatting, it already has that info in its attributes. - Also excluded stdlib frames. This means that the fastapi arguments logs now have no stack info at all, which I think is fine. We can make maybe them point at the endpoint function in the future, but there was no way they could get stack info from calling frames.
- Excluded list/set/dict comprehension frames, partly just to make tests consistent across versions.
- Remove the
stack_offset
param ofLogfire.log
as you suggested. I think it's best to just rip it out rather than deprecate, and it'd be good to hear from users who were using it (which is unlikely). Besides, the_stack_offset
param ofspan
was also removed, and that was also a public API.
Merged so that I can immediately resolve conflicts in https://github.com/pydantic/logfire/pull/151.