fix(logs): Allow null custom attributes without debug warning#1552
fix(logs): Allow null custom attributes without debug warning#1552
Conversation
Null is a valid way to pass no custom attributes, consistent with how metrics already handles this in construct_metric(). Co-Authored-By: Claude <noreply@anthropic.com>
jpnurmi
left a comment
There was a problem hiding this comment.
Thanks! Looks like a miss. Even the docs suggest passing sentry_value_new_null().
sentry-native/include/sentry.h
Line 2203 in 923427f
35ad0f7 to
0876c01
Compare
|
Refactored to use |
Not sure why/how/where the flag comes from, but the Windows ClangCL configuration builds with |
0876c01 to
95c4816
Compare
|
I see, hmm. Looks like it wants all flags to be explicitly handled? |
|
Found this: llvm/llvm-project#148856 |
|
Claude suggests using Edit: I was just curious, but didn't mean we'd start messing with the flags in this PR, by the way. I'm happy with the original else-if proposal. |
Passing null as custom attributes to log functions prints a spurious debug message ("Discarded custom attributes on log: non-object sentry_value_t passed in"). Null is a valid way to indicate "no custom attributes" — the metrics path in
construct_metric()already handles this correctly.Came up while working on sentry-godot metrics support. The Godot SDK has a shared
dictionary_to_attributes()helper used by both logs and metrics. Ideally it returns null for empty dictionaries to avoid an unnecessary allocation, but the log path warned about it.