Repository navigation
f-string magic - #151
f-string magic#151
Conversation
Deploying logfire-docs with
|
| Latest commit: |
a2ff570
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ca814859.logfire-docs.pages.dev |
| Branch Preview URL: | https://alex-fstring-magic.logfire-docs.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
30831f9 to
51e4af9
Compare
| fast_shutdown: bool = False, | ||
| scrubbing_patterns: Sequence[str] | None = None, | ||
| scrubbing_callback: ScrubCallback | None = None, | ||
| fstring_magic: bool | None = None, |
There was a problem hiding this comment.
I think we said we'd change it for fstring_inspect or something? I don't recall the conversation properly.
There was a problem hiding this comment.
Changed to inspect_arguments
| "protobuf >= 4.23.4", | ||
| "typing-extensions >= 4.1.0", | ||
| "tomli >= 2.0.1; python_version < '3.11'", | ||
| "executing>=2.0.1", |
There was a problem hiding this comment.
python_version >= 3.9? Or... optional if not using the feature?
There was a problem hiding this comment.
Started doing this but decided not to. If we accidentally eagerly import executing somewhere we won't notice this breaking 3.8 because it'll be installed in CI.
| fstring_frame = inspect.currentframe() | ||
| if fstring_frame.f_back.f_code.co_filename == Logfire.log.__code__.co_filename: # type: ignore | ||
| # fstring_frame.f_back should be the user's frame. | ||
| # The user called logfire.info or a similar method rather than calling logfire.log directly. | ||
| fstring_frame = fstring_frame.f_back # type: ignore |
There was a problem hiding this comment.
Can't we use some utility function we have already?
There was a problem hiding this comment.
Here 'user' includes us. We need the place where the actual logfire method was called, even if it's inside an integration.
| except Exception: | ||
| source_segment_unparsed = '' |
There was a problem hiding this comment.
No, added a comment
Leaving docs to another PR because https://docs.pydantic.dev/logfire/guides/onboarding_checklist/add_manual_tracing/ needs significant reworking anyway - it already uses f-strings where it shouldn't have and doesn't mention 'manual' formatting.