@@ -243,10 +243,7 @@ static sentry_value_t
243243construct_log (sentry_level_t level , const char * message , va_list args )
244244{
245245 sentry_value_t log = sentry_value_new_object ();
246- sentry_value_t attributes = sentry_value_new_null ();
247- SENTRY_WITH_SCOPE (scope ) {
248- attributes = sentry__value_clone (scope -> attributes );
249- }
246+ sentry_value_t attributes = sentry_value_new_object ();
250247
251248 SENTRY_WITH_OPTIONS (options ) {
252249 // Extract custom attributes if the option is enabled
@@ -258,16 +255,15 @@ construct_log(sentry_level_t level, const char *message, va_list args)
258255 va_end (args_copy );
259256 if (sentry_value_get_type (custom_attributes )
260257 == SENTRY_VALUE_TYPE_OBJECT ) {
261- // Merge global attributes INTO per-log attributes
262- // (per-log attributes take precedence for conflicts)
263- sentry__value_merge_objects (custom_attributes , attributes );
258+ // Clone custom attributes first (per-log attributes take
259+ // precedence for conflicts)
264260 sentry_value_decref (attributes );
265- attributes = custom_attributes ;
261+ attributes = sentry__value_clone ( custom_attributes ) ;
266262 } else {
267263 SENTRY_DEBUG ("Discarded custom attributes on log: non-object "
268264 "sentry_value_t passed in" );
269- sentry_value_decref (custom_attributes );
270265 }
266+ sentry_value_decref (custom_attributes );
271267 }
272268
273269 // Format the message with remaining args (or all args if not using
0 commit comments