Conversation
|
@codecov-ai-reviewer review |
|
On it! We are reviewing the PR and will provide feedback shortly. |
PR DescriptionThis pull request introduces a macro-based API for capturing structured logs within the Sentry Rust SDK. The primary goal is to provide a convenient and expressive way for developers to record log messages with associated attributes, enabling richer context and improved debugging capabilities within the Sentry platform. Click to see moreKey Technical ChangesThe key technical changes include: 1) Creation of a new Architecture DecisionsThe architectural decisions involve using a macro-based API to provide a user-friendly logging interface. The macros leverage the Dependencies and InteractionsThis pull request depends on the Risk ConsiderationsPotential risks include: 1) The Notable Implementation DetailsThe |
szokeasaurusrex
left a comment
There was a problem hiding this comment.
I only reviewed the API, not the macro implementation. I left some comments – I highly recommend you follow my suggestions, but I am also okay with merging this PR without changes as it is guarded by an unstable feature flag
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #827 +/- ##
=======================================
Coverage 72.61% 72.61%
=======================================
Files 63 63
Lines 7598 7598
=======================================
Hits 5517 5517
Misses 2081 2081 🚀 New features to boost your workflow:
|
Adds logging macros.
As described in the doc strings, there are technically 4 variants:
format!tracing, but we only support the values that can be converted to aserde_json::Value.Full example:
Attributes containing a
.will be nested in the UI.The biggest difference with this and the
tracingAPI is that we don't currently support an arbitrary struct as attribute. The way it works there is that it will work with any type implementingDisplay, calling it to get a string representation of the value, or with the special syntax?it will call theDebugimpl.Initially I split this into various internal macros but then they would be exported too, so I've refactored it to only export the needed APIs. This leads to some repetition in the various branches.
The spec says the logging API should be available under a
logger namespace.However it doesn't look there's a way to re-export the macros only under a specific
mod, it seems that withmacro_exportthey will always be exported at the crate level too (e.g.sentry::error!).So for now I'm just exporting them at top level.