@@ -44,11 +44,6 @@ impl<'a, LR: LogRecord> EventVisitor<'a, LR> {
44
44
45
45
#[ cfg( feature = "experimental_metadata_attributes" ) ]
46
46
fn visit_experimental_metadata ( & mut self , meta : & Metadata ) {
47
- self . log_record . add_attribute (
48
- Key :: new ( "log.target" ) ,
49
- AnyValue :: from ( meta. target ( ) . to_owned ( ) ) ,
50
- ) ;
51
-
52
47
if let Some ( module_path) = meta. module_path ( ) {
53
48
self . log_record . add_attribute (
54
49
Key :: new ( "code.namespace" ) ,
@@ -164,6 +159,7 @@ where
164
159
) {
165
160
#[ cfg( feature = "experimental_metadata_attributes" ) ]
166
161
let normalized_meta = event. normalized_metadata ( ) ;
162
+
167
163
#[ cfg( feature = "experimental_metadata_attributes" ) ]
168
164
let meta = normalized_meta. as_ref ( ) . unwrap_or_else ( || event. metadata ( ) ) ;
169
165
@@ -269,7 +265,7 @@ mod tests {
269
265
#[ cfg( not( feature = "experimental_metadata_attributes" ) ) ]
270
266
assert_eq ! ( log. record. attributes_iter( ) . count( ) , 3 ) ;
271
267
#[ cfg( feature = "experimental_metadata_attributes" ) ]
272
- assert_eq ! ( log. record. attributes_iter( ) . count( ) , 8 ) ;
268
+ assert_eq ! ( log. record. attributes_iter( ) . count( ) , 7 ) ;
273
269
assert ! ( attributes_contains(
274
270
& log. record,
275
271
& Key :: new( "event_id" ) ,
@@ -307,7 +303,7 @@ mod tests {
307
303
. collect ( ) ;
308
304
assert ! ( attributes_key. contains( & Key :: new( "code.filepath" ) ) ) ;
309
305
assert ! ( attributes_key. contains( & Key :: new( "code.lineno" ) ) ) ;
310
- assert ! ( attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
306
+ assert ! ( ! attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
311
307
}
312
308
}
313
309
@@ -381,7 +377,7 @@ mod tests {
381
377
#[ cfg( not( feature = "experimental_metadata_attributes" ) ) ]
382
378
assert_eq ! ( log. record. attributes_iter( ) . count( ) , 3 ) ;
383
379
#[ cfg( feature = "experimental_metadata_attributes" ) ]
384
- assert_eq ! ( log. record. attributes_iter( ) . count( ) , 8 ) ;
380
+ assert_eq ! ( log. record. attributes_iter( ) . count( ) , 7 ) ;
385
381
assert ! ( attributes_contains(
386
382
& log. record,
387
383
& Key :: new( "event_id" ) ,
@@ -419,7 +415,7 @@ mod tests {
419
415
. collect ( ) ;
420
416
assert ! ( attributes_key. contains( & Key :: new( "code.filepath" ) ) ) ;
421
417
assert ! ( attributes_key. contains( & Key :: new( "code.lineno" ) ) ) ;
422
- assert ! ( attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
418
+ assert ! ( ! attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
423
419
}
424
420
}
425
421
@@ -461,7 +457,7 @@ mod tests {
461
457
462
458
// Attributes can be polluted when we don't use this feature.
463
459
#[ cfg( feature = "experimental_metadata_attributes" ) ]
464
- assert_eq ! ( log. record. attributes_iter( ) . count( ) , 5 ) ;
460
+ assert_eq ! ( log. record. attributes_iter( ) . count( ) , 4 ) ;
465
461
466
462
#[ cfg( feature = "experimental_metadata_attributes" ) ]
467
463
{
@@ -485,7 +481,7 @@ mod tests {
485
481
. collect ( ) ;
486
482
assert ! ( attributes_key. contains( & Key :: new( "code.filepath" ) ) ) ;
487
483
assert ! ( attributes_key. contains( & Key :: new( "code.lineno" ) ) ) ;
488
- assert ! ( attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
484
+ assert ! ( ! attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
489
485
}
490
486
}
491
487
@@ -558,7 +554,7 @@ mod tests {
558
554
559
555
// Attributes can be polluted when we don't use this feature.
560
556
#[ cfg( feature = "experimental_metadata_attributes" ) ]
561
- assert_eq ! ( log. record. attributes_iter( ) . count( ) , 5 ) ;
557
+ assert_eq ! ( log. record. attributes_iter( ) . count( ) , 4 ) ;
562
558
563
559
#[ cfg( feature = "experimental_metadata_attributes" ) ]
564
560
{
@@ -582,7 +578,7 @@ mod tests {
582
578
. collect ( ) ;
583
579
assert ! ( attributes_key. contains( & Key :: new( "code.filepath" ) ) ) ;
584
580
assert ! ( attributes_key. contains( & Key :: new( "code.lineno" ) ) ) ;
585
- assert ! ( attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
581
+ assert ! ( ! attributes_key. contains( & Key :: new( "log.target" ) ) ) ;
586
582
}
587
583
}
588
584
}
0 commit comments