Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle mocks by calling to_dict on type #897

Merged
merged 2 commits into from
Feb 25, 2025
Merged

Handle mocks by calling to_dict on type #897

merged 2 commits into from
Feb 25, 2025

Conversation

alexmojaki
Copy link
Contributor

@alexmojaki alexmojaki commented Feb 25, 2025

Prevents this:

import unittest.mock
import logfire
logfire.configure()
logfire.info('hi', mock=unittest.mock.Mock())

from producing this:

Screenshot 2025-02-25 at 15 55 05

and avoiding similar problems on other objects with __getattr__.

Copy link

cloudflare-workers-and-pages bot commented Feb 25, 2025

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23b1d29
Status: ✅  Deploy successful!
Preview URL: https://cee62835.logfire-docs.pages.dev
Branch Preview URL: https://alex-mock-to-dict.logfire-docs.pages.dev

View logs

@alexmojaki alexmojaki merged commit 18e2d5d into main Feb 25, 2025
14 checks passed
@alexmojaki alexmojaki deleted the alex/mock-to-dict branch February 25, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant