@@ -162,11 +162,16 @@ mod tests {
162
162
let guard = set_local_logfire ( config) . unwrap ( ) ;
163
163
164
164
tracing:: subscriber:: with_default ( guard. subscriber . clone ( ) , || {
165
+ tracing:: info!( "root event" ) ; // FIXME: this event is not emitted
166
+ tracing:: info!( name: "root event with value" , field_value = 1 ) ; // FIXME: this event is not emitted
167
+
165
168
let root = tracing:: span!( Level :: INFO , "root span" ) . entered ( ) ;
166
169
let _ = tracing:: span!( Level :: INFO , "hello world span" ) . entered ( ) ;
167
170
let _ = tracing:: span!( Level :: DEBUG , "debug span" ) ;
168
171
let _ = tracing:: span!( parent: & root, Level :: DEBUG , "debug span with explicit parent" ) ;
172
+
169
173
tracing:: info!( "hello world log" ) ;
174
+ tracing:: info!( name: "hello world log with value" , field_value = 1 ) ;
170
175
} ) ;
171
176
172
177
let spans = exporter. get_finished_spans ( ) . unwrap ( ) ;
@@ -221,7 +226,7 @@ mod tests {
221
226
"code.lineno",
222
227
),
223
228
value: I64(
224
- 11 ,
229
+ 14 ,
225
230
),
226
231
},
227
232
KeyValue {
@@ -327,7 +332,7 @@ mod tests {
327
332
"code.lineno",
328
333
),
329
334
value: I64(
330
- 12 ,
335
+ 15 ,
331
336
),
332
337
},
333
338
KeyValue {
@@ -443,7 +448,7 @@ mod tests {
443
448
"code.lineno",
444
449
),
445
450
value: I64(
446
- 12 ,
451
+ 15 ,
447
452
),
448
453
},
449
454
KeyValue {
@@ -565,7 +570,7 @@ mod tests {
565
570
"code.lineno",
566
571
),
567
572
value: I64(
568
- 13 ,
573
+ 16 ,
569
574
),
570
575
},
571
576
KeyValue {
@@ -681,7 +686,7 @@ mod tests {
681
686
"code.lineno",
682
687
),
683
688
value: I64(
684
- 13 ,
689
+ 16 ,
685
690
),
686
691
},
687
692
KeyValue {
@@ -803,7 +808,7 @@ mod tests {
803
808
"code.lineno",
804
809
),
805
810
value: I64(
806
- 14 ,
811
+ 17 ,
807
812
),
808
813
},
809
814
KeyValue {
@@ -919,7 +924,7 @@ mod tests {
919
924
"code.lineno",
920
925
),
921
926
value: I64(
922
- 14 ,
927
+ 17 ,
923
928
),
924
929
},
925
930
KeyValue {
@@ -1041,7 +1046,7 @@ mod tests {
1041
1046
"code.lineno",
1042
1047
),
1043
1048
value: I64(
1044
- 11 ,
1049
+ 14 ,
1045
1050
),
1046
1051
},
1047
1052
KeyValue {
@@ -1152,7 +1157,73 @@ mod tests {
1152
1157
"code.lineno",
1153
1158
),
1154
1159
value: I64(
1155
- 169,
1160
+ 173,
1161
+ ),
1162
+ },
1163
+ ],
1164
+ dropped_attributes_count: 0,
1165
+ },
1166
+ Event {
1167
+ name: "hello world log with value",
1168
+ timestamp: SystemTime {
1169
+ tv_sec: 9,
1170
+ tv_nsec: 0,
1171
+ },
1172
+ attributes: [
1173
+ KeyValue {
1174
+ key: Static(
1175
+ "level",
1176
+ ),
1177
+ value: String(
1178
+ Static(
1179
+ "INFO",
1180
+ ),
1181
+ ),
1182
+ },
1183
+ KeyValue {
1184
+ key: Static(
1185
+ "target",
1186
+ ),
1187
+ value: String(
1188
+ Static(
1189
+ "logfire::bridges::tracing::tests",
1190
+ ),
1191
+ ),
1192
+ },
1193
+ KeyValue {
1194
+ key: Static(
1195
+ "field_value",
1196
+ ),
1197
+ value: I64(
1198
+ 1,
1199
+ ),
1200
+ },
1201
+ KeyValue {
1202
+ key: Static(
1203
+ "code.filepath",
1204
+ ),
1205
+ value: String(
1206
+ Static(
1207
+ "src/bridges/tracing.rs",
1208
+ ),
1209
+ ),
1210
+ },
1211
+ KeyValue {
1212
+ key: Static(
1213
+ "code.namespace",
1214
+ ),
1215
+ value: String(
1216
+ Static(
1217
+ "logfire::bridges::tracing::tests",
1218
+ ),
1219
+ ),
1220
+ },
1221
+ KeyValue {
1222
+ key: Static(
1223
+ "code.lineno",
1224
+ ),
1225
+ value: I64(
1226
+ 174,
1156
1227
),
1157
1228
},
1158
1229
],
@@ -1195,11 +1266,16 @@ mod tests {
1195
1266
let guard = set_local_logfire ( config) . unwrap ( ) ;
1196
1267
1197
1268
tracing:: subscriber:: with_default ( guard. subscriber . clone ( ) , || {
1269
+ tracing:: info!( "root event" ) ;
1270
+ tracing:: info!( name: "root event with value" , field_value = 1 ) ;
1271
+
1198
1272
let root = tracing:: span!( Level :: INFO , "root span" ) . entered ( ) ;
1199
1273
let _ = tracing:: span!( Level :: INFO , "hello world span" ) . entered ( ) ;
1200
1274
let _ = tracing:: span!( Level :: DEBUG , "debug span" ) ;
1201
1275
let _ = tracing:: span!( parent: & root, Level :: DEBUG , "debug span with explicit parent" ) ;
1276
+
1202
1277
tracing:: info!( "hello world log" ) ;
1278
+ tracing:: info!( name: "hello world log with value" , field_value = 1 ) ;
1203
1279
} ) ;
1204
1280
1205
1281
guard. shutdown_handler . shutdown ( ) . unwrap ( ) ;
@@ -1217,11 +1293,14 @@ mod tests {
1217
1293
} ) ;
1218
1294
1219
1295
assert_snapshot ! ( output, @r#"
1220
- [2m1970-01-01T00:00:00.000000Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mroot span[0m
1221
- [2m1970-01-01T00:00:00.000001Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mhello world span[0m
1222
- [2m1970-01-01T00:00:00.000002Z[0m[34m DEBUG[0m [2;3mlogfire::bridges::tracing::tests[0m [1mdebug span[0m
1223
- [2m1970-01-01T00:00:00.000003Z[0m[34m DEBUG[0m [2;3mlogfire::bridges::tracing::tests[0m [1mdebug span with explicit parent[0m
1224
- [2m1970-01-01T00:00:00.000004Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mhello world log[0m
1296
+ [2m1970-01-01T00:00:00.000000Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mroot event[0m
1297
+ [2m1970-01-01T00:00:00.000001Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mroot event with value[0m [3mfield_value[0m=1
1298
+ [2m1970-01-01T00:00:00.000002Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mroot span[0m
1299
+ [2m1970-01-01T00:00:00.000003Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mhello world span[0m
1300
+ [2m1970-01-01T00:00:00.000004Z[0m[34m DEBUG[0m [2;3mlogfire::bridges::tracing::tests[0m [1mdebug span[0m
1301
+ [2m1970-01-01T00:00:00.000005Z[0m[34m DEBUG[0m [2;3mlogfire::bridges::tracing::tests[0m [1mdebug span with explicit parent[0m
1302
+ [2m1970-01-01T00:00:00.000006Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mhello world log[0m
1303
+ [2m1970-01-01T00:00:00.000007Z[0m[32m INFO[0m [2;3mlogfire::bridges::tracing::tests[0m [1mhello world log with value[0m [3mfield_value[0m=1
1225
1304
"# ) ;
1226
1305
}
1227
1306
}
0 commit comments