1 #![deny(warnings)]
2 use tracing::Level;
3 
4 #[macro_use]
5 extern crate tracing;
6 // Tests that macros work across various invocation syntax.
7 //
8 // These are quite repetitive, and _could_ be generated by a macro. However,
9 // they're compile-time tests, so I want to get line numbers etc out of
10 // failures, and producing them with a macro would muddy the waters a bit.
11 
12 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
13 #[test]
14 fn span() {
15     span!(target: "foo_events", Level::DEBUG, "foo", bar.baz = ?2, quux = %3, quuux = 4);
16     span!(target: "foo_events", Level::DEBUG, "foo", bar.baz = 2, quux = 3);
17     span!(target: "foo_events", Level::DEBUG, "foo", bar.baz = 2, quux = 4,);
18     span!(target: "foo_events", Level::DEBUG, "foo");
19     span!(target: "foo_events", Level::DEBUG, "bar",);
20     span!(Level::DEBUG, "foo", bar.baz = 2, quux = 3);
21     span!(Level::DEBUG, "foo", bar.baz = 2, quux = 4,);
22     span!(Level::DEBUG, "foo", bar.baz = 2, quux = 3);
23     span!(Level::DEBUG, "foo", bar.baz = 2, quux = 4,);
24     span!(Level::DEBUG, "foo", bar.baz = ?2);
25     span!(Level::DEBUG, "foo", bar.baz = %2);
26     span!(Level::DEBUG, "foo");
27     span!(Level::DEBUG, "bar",);
28 }
29 
30 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
31 #[test]
32 fn trace_span() {
33     trace_span!(target: "foo_events", "foo", bar.baz = ?2, quux = %3, quuux = 4);
34     trace_span!(target: "foo_events", "foo", bar.baz = 2, quux = 3);
35     trace_span!(target: "foo_events", "foo", bar.baz = 2, quux = 4,);
36     trace_span!(target: "foo_events", "foo");
37     trace_span!(target: "foo_events", "bar",);
38     trace_span!("foo", bar.baz = 2, quux = 3);
39     trace_span!("foo", bar.baz = 2, quux = 4,);
40     trace_span!("foo", bar.baz = ?2);
41     trace_span!("foo", bar.baz = %2);
42     trace_span!("bar");
43     trace_span!("bar",);
44 }
45 
46 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
47 #[test]
48 fn debug_span() {
49     debug_span!(target: "foo_events", "foo", bar.baz = ?2, quux = %3, quuux = 4);
50     debug_span!(target: "foo_events", "foo", bar.baz = 2, quux = 3);
51     debug_span!(target: "foo_events", "foo", bar.baz = 2, quux = 4,);
52     debug_span!(target: "foo_events", "foo");
53     debug_span!(target: "foo_events", "bar",);
54     debug_span!("foo", bar.baz = 2, quux = 3);
55     debug_span!("foo", bar.baz = 2, quux = 4,);
56     debug_span!("foo", bar.baz = ?2);
57     debug_span!("foo", bar.baz = %2);
58     debug_span!("bar");
59     debug_span!("bar",);
60 }
61 
62 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
63 #[test]
64 fn info_span() {
65     info_span!(target: "foo_events", "foo", bar.baz = ?2, quux = %3, quuux = 4);
66     info_span!(target: "foo_events", "foo", bar.baz = 2, quux = 3);
67     info_span!(target: "foo_events", "foo", bar.baz = 2, quux = 4,);
68     info_span!(target: "foo_events", "foo");
69     info_span!(target: "foo_events", "bar",);
70     info_span!("foo", bar.baz = 2, quux = 3);
71     info_span!("foo", bar.baz = 2, quux = 4,);
72     info_span!("foo", bar.baz = ?2);
73     info_span!("foo", bar.baz = %2);
74     info_span!("bar");
75     info_span!("bar",);
76 }
77 
78 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
79 #[test]
80 fn warn_span() {
81     warn_span!(target: "foo_events", "foo", bar.baz = ?2, quux = %3, quuux = 4);
82     warn_span!(target: "foo_events", "foo", bar.baz = 2, quux = 3);
83     warn_span!(target: "foo_events", "foo", bar.baz = 2, quux = 4,);
84     warn_span!(target: "foo_events", "foo");
85     warn_span!(target: "foo_events", "bar",);
86     warn_span!("foo", bar.baz = 2, quux = 3);
87     warn_span!("foo", bar.baz = 2, quux = 4,);
88     warn_span!("foo", bar.baz = ?2);
89     warn_span!("foo", bar.baz = %2);
90     warn_span!("bar");
91     warn_span!("bar",);
92 }
93 
94 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
95 #[test]
96 fn error_span() {
97     error_span!(target: "foo_events", "foo", bar.baz = ?2, quux = %3, quuux = 4);
98     error_span!(target: "foo_events", "foo", bar.baz = 2, quux = 3);
99     error_span!(target: "foo_events", "foo", bar.baz = 2, quux = 4,);
100     error_span!(target: "foo_events", "foo");
101     error_span!(target: "foo_events", "bar",);
102     error_span!("foo", bar.baz = 2, quux = 3);
103     error_span!("foo", bar.baz = 2, quux = 4,);
104     error_span!("foo", bar.baz = ?2);
105     error_span!("foo", bar.baz = %2);
106     error_span!("bar");
107     error_span!("bar",);
108 }
109 
110 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
111 #[test]
112 fn span_root() {
113     span!(target: "foo_events", parent: None, Level::TRACE, "foo", bar.baz = 2, quux = 3);
114     span!(target: "foo_events", parent: None, Level::TRACE, "foo", bar.baz = 2, quux = 3);
115     span!(target: "foo_events", parent: None, Level::TRACE, "foo", bar.baz = 2, quux = 4,);
116     span!(target: "foo_events", parent: None, Level::TRACE, "foo");
117     span!(target: "foo_events", parent: None, Level::TRACE, "bar",);
118     span!(parent: None, Level::DEBUG, "foo", bar.baz = 2, quux = 3);
119     span!(parent: None, Level::DEBUG, "foo", bar.baz = 2, quux = 4,);
120     span!(parent: None, Level::DEBUG, "foo");
121     span!(parent: None, Level::DEBUG, "bar",);
122 }
123 
124 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
125 #[test]
126 fn trace_span_root() {
127     trace_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 3);
128     trace_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 4,);
129     trace_span!(target: "foo_events", parent: None, "foo");
130     trace_span!(target: "foo_events", parent: None, "bar",);
131     trace_span!(parent: None, "foo", bar.baz = 2, quux = 3);
132     trace_span!(parent: None, "foo", bar.baz = 2, quux = 4,);
133     trace_span!(parent: None, "foo");
134     trace_span!(parent: None, "bar",);
135 }
136 
137 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
138 #[test]
139 fn debug_span_root() {
140     debug_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 3);
141     debug_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 4,);
142     debug_span!(target: "foo_events", parent: None, "foo");
143     debug_span!(target: "foo_events", parent: None, "bar",);
144     debug_span!(parent: None, "foo", bar.baz = 2, quux = 3);
145     debug_span!(parent: None, "foo", bar.baz = 2, quux = 4,);
146     debug_span!(parent: None, "foo");
147     debug_span!(parent: None, "bar",);
148 }
149 
150 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
151 #[test]
152 fn info_span_root() {
153     info_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 3);
154     info_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 4,);
155     info_span!(target: "foo_events", parent: None, "foo");
156     info_span!(target: "foo_events", parent: None, "bar",);
157     info_span!(parent: None, "foo", bar.baz = 2, quux = 3);
158     info_span!(parent: None, "foo", bar.baz = 2, quux = 4,);
159     info_span!(parent: None, "foo");
160     info_span!(parent: None, "bar",);
161 }
162 
163 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
164 #[test]
165 fn warn_span_root() {
166     warn_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 3);
167     warn_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 4,);
168     warn_span!(target: "foo_events", parent: None, "foo");
169     warn_span!(target: "foo_events", parent: None, "bar",);
170     warn_span!(parent: None, "foo", bar.baz = 2, quux = 3);
171     warn_span!(parent: None, "foo", bar.baz = 2, quux = 4,);
172     warn_span!(parent: None, "foo");
173     warn_span!(parent: None, "bar",);
174 }
175 
176 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
177 #[test]
178 fn error_span_root() {
179     error_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 3);
180     error_span!(target: "foo_events", parent: None, "foo", bar.baz = 2, quux = 4,);
181     error_span!(target: "foo_events", parent: None, "foo");
182     error_span!(target: "foo_events", parent: None, "bar",);
183     error_span!(parent: None, "foo", bar.baz = 2, quux = 3);
184     error_span!(parent: None, "foo", bar.baz = 2, quux = 4,);
185     error_span!(parent: None, "foo");
186     error_span!(parent: None, "bar",);
187 }
188 
189 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
190 #[test]
191 fn span_with_parent() {
192     let p = span!(Level::TRACE, "im_a_parent!");
193     span!(target: "foo_events", parent: &p, Level::TRACE, "foo", bar.baz = 2, quux = 3);
194     span!(target: "foo_events", parent: &p, Level::TRACE, "foo", bar.baz = 2, quux = 4,);
195     span!(target: "foo_events", parent: &p, Level::TRACE, "foo");
196     span!(target: "foo_events", parent: &p, Level::TRACE, "bar",);
197     span!(parent: &p, Level::DEBUG, "foo", bar.baz = 2, quux = 3);
198     span!(parent: &p, Level::DEBUG, "foo", bar.baz = 2, quux = 4,);
199     span!(parent: &p, Level::DEBUG, "foo");
200     span!(parent: &p, Level::DEBUG, "bar",);
201 }
202 
203 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
204 #[test]
205 fn trace_span_with_parent() {
206     let p = span!(Level::TRACE, "im_a_parent!");
207     trace_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 3);
208     trace_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 4,);
209     trace_span!(target: "foo_events", parent: &p, "foo");
210     trace_span!(target: "foo_events", parent: &p, "bar",);
211 
212     trace_span!(parent: &p, "foo", bar.baz = 2, quux = 3);
213     trace_span!(parent: &p, "foo", bar.baz = 2, quux = 4,);
214 
215     trace_span!(parent: &p, "foo");
216     trace_span!(parent: &p, "bar",);
217 }
218 
219 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
220 #[test]
221 fn debug_span_with_parent() {
222     let p = span!(Level::TRACE, "im_a_parent!");
223     debug_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 3);
224     debug_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 4,);
225     debug_span!(target: "foo_events", parent: &p, "foo");
226     debug_span!(target: "foo_events", parent: &p, "bar",);
227 
228     debug_span!(parent: &p, "foo", bar.baz = 2, quux = 3);
229     debug_span!(parent: &p, "foo", bar.baz = 2, quux = 4,);
230 
231     debug_span!(parent: &p, "foo");
232     debug_span!(parent: &p, "bar",);
233 }
234 
235 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
236 #[test]
237 fn info_span_with_parent() {
238     let p = span!(Level::TRACE, "im_a_parent!");
239     info_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 3);
240     info_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 4,);
241     info_span!(target: "foo_events", parent: &p, "foo");
242     info_span!(target: "foo_events", parent: &p, "bar",);
243 
244     info_span!(parent: &p, "foo", bar.baz = 2, quux = 3);
245     info_span!(parent: &p, "foo", bar.baz = 2, quux = 4,);
246 
247     info_span!(parent: &p, "foo");
248     info_span!(parent: &p, "bar",);
249 }
250 
251 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
252 #[test]
253 fn warn_span_with_parent() {
254     let p = span!(Level::TRACE, "im_a_parent!");
255     warn_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 3);
256     warn_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 4,);
257     warn_span!(target: "foo_events", parent: &p, "foo");
258     warn_span!(target: "foo_events", parent: &p, "bar",);
259 
260     warn_span!(parent: &p, "foo", bar.baz = 2, quux = 3);
261     warn_span!(parent: &p, "foo", bar.baz = 2, quux = 4,);
262 
263     warn_span!(parent: &p, "foo");
264     warn_span!(parent: &p, "bar",);
265 }
266 
267 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
268 #[test]
269 fn error_span_with_parent() {
270     let p = span!(Level::TRACE, "im_a_parent!");
271     error_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 3);
272     error_span!(target: "foo_events", parent: &p, "foo", bar.baz = 2, quux = 4,);
273     error_span!(target: "foo_events", parent: &p, "foo");
274     error_span!(target: "foo_events", parent: &p, "bar",);
275 
276     error_span!(parent: &p, "foo", bar.baz = 2, quux = 3);
277     error_span!(parent: &p, "foo", bar.baz = 2, quux = 4,);
278 
279     error_span!(parent: &p, "foo");
280     error_span!(parent: &p, "bar",);
281 }
282 
283 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
284 #[test]
285 fn span_with_non_rust_symbol() {
286     span!(Level::TRACE, "non-rust", "guid:x-request-id" = ?"abcdef", "more {}", 42);
287     span!(Level::TRACE, "non-rust", "guid:x-request-id" = %"abcdef", "more {}", 51);
288     span!(
289         Level::TRACE,
290         "non-rust",
291         "guid:x-request-id" = "abcdef",
292         "more {}",
293         60
294     );
295     span!(Level::TRACE, "non-rust", "guid:x-request-id" = ?"abcdef");
296     span!(Level::TRACE, "non-rust", "guid:x-request-id" = %"abcdef");
297     span!(Level::TRACE, "non-rust", "guid:x-request-id" = "abcdef");
298 }
299 
300 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
301 #[test]
302 fn event() {
303     event!(Level::DEBUG, foo = ?3, bar.baz = %2, quux = false);
304     event!(Level::DEBUG, foo = 3, bar.baz = 2, quux = false);
305     event!(Level::DEBUG, foo = 3, bar.baz = 3,);
306     event!(Level::DEBUG, "foo");
307     event!(Level::DEBUG, "foo: {}", 3);
308     event!(Level::INFO, foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
309     event!(
310         Level::INFO,
311         foo = 3,
312         bar.baz = 2,
313         quux = false,
314         "hello world {:?}",
315         42
316     );
317     event!(Level::INFO, foo = 3, bar.baz = 3, "hello world {:?}", 42,);
318     event!(Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
319     event!(Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
320     event!(Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
321     event!(Level::DEBUG, { foo = ?2, bar.baz = %78 }, "quux");
322     event!(target: "foo_events", Level::DEBUG, foo = 3, bar.baz = 2, quux = false);
323     event!(target: "foo_events", Level::DEBUG, foo = 3, bar.baz = 3,);
324     event!(target: "foo_events", Level::DEBUG, "foo");
325     event!(target: "foo_events", Level::DEBUG, "foo: {}", 3);
326     event!(target: "foo_events", Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
327     event!(target: "foo_events", Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
328     event!(target: "foo_events", Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
329     event!(target: "foo_events", Level::DEBUG, { foo = 2, bar.baz = 78, }, "quux");
330     let foo = 1;
331     event!(Level::DEBUG, ?foo);
332     event!(Level::DEBUG, %foo);
333     event!(Level::DEBUG, foo);
334 }
335 
336 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
337 #[test]
338 fn locals_with_message() {
339     let data = (42, "forty-two");
340     let private_data = "private";
341     let error = "a bad error";
342     event!(Level::ERROR, %error, "Received error");
343     event!(
344         target: "app_events",
345         Level::WARN,
346         private_data,
347         ?data,
348         "App warning: {}",
349         error
350     );
351 }
352 
353 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
354 #[test]
355 fn locals_no_message() {
356     let data = (42, "forty-two");
357     let private_data = "private";
358     let error = "a bad error";
359     event!(
360         target: "app_events",
361         Level::WARN,
362         private_data,
363         ?data,
364     );
365     event!(
366         target: "app_events",
367         Level::WARN,
368         private_data,
369         ?data,
370         error,
371     );
372     event!(
373         target: "app_events",
374         Level::WARN,
375         private_data,
376         ?data,
377         error
378     );
379     event!(Level::WARN, private_data, ?data, error,);
380 }
381 
382 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
383 #[test]
384 fn trace() {
385     trace!(foo = ?3, bar.baz = %2, quux = false);
386     trace!(foo = 3, bar.baz = 2, quux = false);
387     trace!(foo = 3, bar.baz = 3,);
388     trace!("foo");
389     trace!("foo: {}", 3);
390     trace!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
391     trace!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
392     trace!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
393     trace!({ foo = 3, bar.baz = 80 }, "quux");
394     trace!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
395     trace!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
396     trace!({ foo = 2, bar.baz = 78 }, "quux");
397     trace!({ foo = ?2, bar.baz = %78 }, "quux");
398     trace!(target: "foo_events", foo = 3, bar.baz = 2, quux = false);
399     trace!(target: "foo_events", foo = 3, bar.baz = 3,);
400     trace!(target: "foo_events", "foo");
401     trace!(target: "foo_events", "foo: {}", 3);
402     trace!(target: "foo_events", { foo = 3, bar.baz = 80 }, "quux");
403     trace!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}", true);
404     trace!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
405     trace!(target: "foo_events", { foo = 2, bar.baz = 78, }, "quux");
406     let foo = 1;
407     trace!(?foo);
408     trace!(%foo);
409     trace!(foo);
410 }
411 
412 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
413 #[test]
414 fn debug() {
415     debug!(foo = ?3, bar.baz = %2, quux = false);
416     debug!(foo = 3, bar.baz = 2, quux = false);
417     debug!(foo = 3, bar.baz = 3,);
418     debug!("foo");
419     debug!("foo: {}", 3);
420     debug!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
421     debug!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
422     debug!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
423     debug!({ foo = 3, bar.baz = 80 }, "quux");
424     debug!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
425     debug!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
426     debug!({ foo = 2, bar.baz = 78 }, "quux");
427     debug!({ foo = ?2, bar.baz = %78 }, "quux");
428     debug!(target: "foo_events", foo = 3, bar.baz = 2, quux = false);
429     debug!(target: "foo_events", foo = 3, bar.baz = 3,);
430     debug!(target: "foo_events", "foo");
431     debug!(target: "foo_events", "foo: {}", 3);
432     debug!(target: "foo_events", { foo = 3, bar.baz = 80 }, "quux");
433     debug!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}", true);
434     debug!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
435     debug!(target: "foo_events", { foo = 2, bar.baz = 78, }, "quux");
436     let foo = 1;
437     debug!(?foo);
438     debug!(%foo);
439     debug!(foo);
440 }
441 
442 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
443 #[test]
444 fn info() {
445     info!(foo = ?3, bar.baz = %2, quux = false);
446     info!(foo = 3, bar.baz = 2, quux = false);
447     info!(foo = 3, bar.baz = 3,);
448     info!("foo");
449     info!("foo: {}", 3);
450     info!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
451     info!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
452     info!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
453     info!({ foo = 3, bar.baz = 80 }, "quux");
454     info!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
455     info!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
456     info!({ foo = 2, bar.baz = 78 }, "quux");
457     info!({ foo = ?2, bar.baz = %78 }, "quux");
458     info!(target: "foo_events", foo = 3, bar.baz = 2, quux = false);
459     info!(target: "foo_events", foo = 3, bar.baz = 3,);
460     info!(target: "foo_events", "foo");
461     info!(target: "foo_events", "foo: {}", 3);
462     info!(target: "foo_events", { foo = 3, bar.baz = 80 }, "quux");
463     info!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}", true);
464     info!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
465     info!(target: "foo_events", { foo = 2, bar.baz = 78, }, "quux");
466     let foo = 1;
467     info!(?foo);
468     info!(%foo);
469     info!(foo);
470 }
471 
472 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
473 #[test]
474 fn warn() {
475     warn!(foo = ?3, bar.baz = %2, quux = false);
476     warn!(foo = 3, bar.baz = 2, quux = false);
477     warn!(foo = 3, bar.baz = 3,);
478     warn!("foo");
479     warn!("foo: {}", 3);
480     warn!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
481     warn!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
482     warn!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
483     warn!({ foo = 3, bar.baz = 80 }, "quux");
484     warn!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
485     warn!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
486     warn!({ foo = 2, bar.baz = 78 }, "quux");
487     warn!({ foo = ?2, bar.baz = %78 }, "quux");
488     warn!(target: "foo_events", foo = 3, bar.baz = 2, quux = false);
489     warn!(target: "foo_events", foo = 3, bar.baz = 3,);
490     warn!(target: "foo_events", "foo");
491     warn!(target: "foo_events", "foo: {}", 3);
492     warn!(target: "foo_events", { foo = 3, bar.baz = 80 }, "quux");
493     warn!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}", true);
494     warn!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
495     warn!(target: "foo_events", { foo = 2, bar.baz = 78, }, "quux");
496     let foo = 1;
497     warn!(?foo);
498     warn!(%foo);
499     warn!(foo);
500 }
501 
502 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
503 #[test]
504 fn error() {
505     error!(foo = ?3, bar.baz = %2, quux = false);
506     error!(foo = 3, bar.baz = 2, quux = false);
507     error!(foo = 3, bar.baz = 3,);
508     error!("foo");
509     error!("foo: {}", 3);
510     error!(foo = ?3, bar.baz = %2, quux = false, "hello world {:?}", 42);
511     error!(foo = 3, bar.baz = 2, quux = false, "hello world {:?}", 42);
512     error!(foo = 3, bar.baz = 3, "hello world {:?}", 42,);
513     error!({ foo = 3, bar.baz = 80 }, "quux");
514     error!({ foo = 2, bar.baz = 79 }, "quux {:?}", true);
515     error!({ foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
516     error!({ foo = 2, bar.baz = 78, }, "quux");
517     error!({ foo = ?2, bar.baz = %78 }, "quux");
518     error!(target: "foo_events", foo = 3, bar.baz = 2, quux = false);
519     error!(target: "foo_events", foo = 3, bar.baz = 3,);
520     error!(target: "foo_events", "foo");
521     error!(target: "foo_events", "foo: {}", 3);
522     error!(target: "foo_events", { foo = 3, bar.baz = 80 }, "quux");
523     error!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}", true);
524     error!(target: "foo_events", { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
525     error!(target: "foo_events", { foo = 2, bar.baz = 78, }, "quux");
526     let foo = 1;
527     error!(?foo);
528     error!(%foo);
529     error!(foo);
530 }
531 
532 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
533 #[test]
534 fn event_root() {
535     event!(parent: None, Level::DEBUG, foo = ?3, bar.baz = %2, quux = false);
536     event!(
537         parent: None,
538         Level::DEBUG,
539         foo = 3,
540         bar.baz = 2,
541         quux = false
542     );
543     event!(parent: None, Level::DEBUG, foo = 3, bar.baz = 3,);
544     event!(parent: None, Level::DEBUG, "foo");
545     event!(parent: None, Level::DEBUG, "foo: {}", 3);
546     event!(parent: None, Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
547     event!(parent: None, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
548     event!(parent: None, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
549     event!(parent: None, Level::DEBUG, { foo = ?2, bar.baz = %78 }, "quux");
550     event!(target: "foo_events", parent: None, Level::DEBUG, foo = 3, bar.baz = 2, quux = false);
551     event!(target: "foo_events", parent: None, Level::DEBUG, foo = 3, bar.baz = 3,);
552     event!(target: "foo_events", parent: None, Level::DEBUG, "foo");
553     event!(target: "foo_events", parent: None, Level::DEBUG, "foo: {}", 3);
554     event!(target: "foo_events", parent: None, Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
555     event!(target: "foo_events", parent: None, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
556     event!(target: "foo_events", parent: None, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
557     event!(target: "foo_events", parent: None, Level::DEBUG, { foo = 2, bar.baz = 78, }, "quux");
558 }
559 
560 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
561 #[test]
562 fn trace_root() {
563     trace!(parent: None, foo = ?3, bar.baz = %2, quux = false);
564     trace!(parent: None, foo = 3, bar.baz = 2, quux = false);
565     trace!(parent: None, foo = 3, bar.baz = 3,);
566     trace!(parent: None, "foo");
567     trace!(parent: None, "foo: {}", 3);
568     trace!(parent: None, { foo = 3, bar.baz = 80 }, "quux");
569     trace!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
570     trace!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
571     trace!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
572     trace!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
573     trace!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
574     trace!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
575     trace!(target: "foo_events", parent: None, "foo");
576     trace!(target: "foo_events", parent: None, "foo: {}", 3);
577     trace!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
578     trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
579     trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
580     trace!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
581 }
582 
583 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
584 #[test]
585 fn debug_root() {
586     debug!(parent: None, foo = ?3, bar.baz = %2, quux = false);
587     debug!(parent: None, foo = 3, bar.baz = 2, quux = false);
588     debug!(parent: None, foo = 3, bar.baz = 3,);
589     debug!(parent: None, "foo");
590     debug!(parent: None, "foo: {}", 3);
591     debug!(parent: None, { foo = 3, bar.baz = 80 }, "quux");
592     debug!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
593     debug!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
594     debug!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
595     debug!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
596     debug!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
597     debug!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
598     debug!(target: "foo_events", parent: None, "foo");
599     debug!(target: "foo_events", parent: None, "foo: {}", 3);
600     debug!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
601     debug!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
602     debug!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
603     debug!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
604 }
605 
606 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
607 #[test]
608 fn info_root() {
609     info!(parent: None, foo = ?3, bar.baz = %2, quux = false);
610     info!(parent: None, foo = 3, bar.baz = 2, quux = false);
611     info!(parent: None, foo = 3, bar.baz = 3,);
612     info!(parent: None, "foo");
613     info!(parent: None, "foo: {}", 3);
614     info!(parent: None, { foo = 3, bar.baz = 80 }, "quux");
615     info!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
616     info!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
617     info!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
618     info!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
619     info!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
620     info!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
621     info!(target: "foo_events", parent: None, "foo");
622     info!(target: "foo_events", parent: None, "foo: {}", 3);
623     info!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
624     info!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
625     info!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
626     info!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
627 }
628 
629 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
630 #[test]
631 fn warn_root() {
632     warn!(parent: None, foo = ?3, bar.baz = %2, quux = false);
633     warn!(parent: None, foo = 3, bar.baz = 2, quux = false);
634     warn!(parent: None, foo = 3, bar.baz = 3,);
635     warn!(parent: None, "foo");
636     warn!(parent: None, "foo: {}", 3);
637     warn!(parent: None, { foo = 3, bar.baz = 80 }, "quux");
638     warn!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
639     warn!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
640     warn!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
641     warn!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
642     warn!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
643     warn!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
644     warn!(target: "foo_events", parent: None, "foo");
645     warn!(target: "foo_events", parent: None, "foo: {}", 3);
646     warn!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
647     warn!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
648     warn!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
649     warn!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
650 }
651 
652 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
653 #[test]
654 fn error_root() {
655     error!(parent: None, foo = ?3, bar.baz = %2, quux = false);
656     error!(parent: None, foo = 3, bar.baz = 2, quux = false);
657     error!(parent: None, foo = 3, bar.baz = 3,);
658     error!(parent: None, "foo");
659     error!(parent: None, "foo: {}", 3);
660     error!(parent: None, { foo = 3, bar.baz = 80 }, "quux");
661     error!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
662     error!(parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
663     error!(parent: None, { foo = 2, bar.baz = 78 }, "quux");
664     error!(parent: None, { foo = ?2, bar.baz = %78 }, "quux");
665     error!(target: "foo_events", parent: None, foo = 3, bar.baz = 2, quux = false);
666     error!(target: "foo_events", parent: None, foo = 3, bar.baz = 3,);
667     error!(target: "foo_events", parent: None, "foo");
668     error!(target: "foo_events", parent: None, "foo: {}", 3);
669     error!(target: "foo_events", parent: None, { foo = 3, bar.baz = 80 }, "quux");
670     error!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
671     error!(target: "foo_events", parent: None, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
672     error!(target: "foo_events", parent: None, { foo = 2, bar.baz = 78, }, "quux");
673 }
674 
675 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
676 #[test]
677 fn event_with_parent() {
678     let p = span!(Level::TRACE, "im_a_parent!");
679     event!(parent: &p, Level::DEBUG, foo = ?3, bar.baz = %2, quux = false);
680     event!(parent: &p, Level::DEBUG, foo = 3, bar.baz = 2, quux = false);
681     event!(parent: &p, Level::DEBUG, foo = 3, bar.baz = 3,);
682     event!(parent: &p, Level::DEBUG, "foo");
683     event!(parent: &p, Level::DEBUG, "foo: {}", 3);
684     event!(parent: &p, Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
685     event!(parent: &p, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
686     event!(parent: &p, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
687     event!(parent: &p, Level::DEBUG, { foo = ?2, bar.baz = %78 }, "quux");
688     event!(target: "foo_events", parent: &p, Level::DEBUG, foo = 3, bar.baz = 2, quux = false);
689     event!(target: "foo_events", parent: &p, Level::DEBUG, foo = 3, bar.baz = 3,);
690     event!(target: "foo_events", parent: &p, Level::DEBUG, "foo");
691     event!(target: "foo_events", parent: &p, Level::DEBUG, "foo: {}", 3);
692     event!(target: "foo_events", parent: &p, Level::DEBUG, { foo = 3, bar.baz = 80 }, "quux");
693     event!(target: "foo_events", parent: &p, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
694     event!(target: "foo_events", parent: &p, Level::DEBUG, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
695     event!(target: "foo_events", parent: &p, Level::DEBUG, { foo = 2, bar.baz = 78, }, "quux");
696 }
697 
698 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
699 #[test]
700 fn trace_with_parent() {
701     let p = span!(Level::TRACE, "im_a_parent!");
702     trace!(parent: &p, foo = ?3, bar.baz = %2, quux = false);
703     trace!(parent: &p, foo = 3, bar.baz = 2, quux = false);
704     trace!(parent: &p, foo = 3, bar.baz = 3,);
705     trace!(parent: &p, "foo");
706     trace!(parent: &p, "foo: {}", 3);
707     trace!(parent: &p, { foo = 3, bar.baz = 80 }, "quux");
708     trace!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
709     trace!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
710     trace!(parent: &p, { foo = 2, bar.baz = 78 }, "quux");
711     trace!(parent: &p, { foo = ?2, bar.baz = %78 }, "quux");
712     trace!(target: "foo_events", parent: &p, foo = 3, bar.baz = 2, quux = false);
713     trace!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
714     trace!(target: "foo_events", parent: &p, "foo");
715     trace!(target: "foo_events", parent: &p, "foo: {}", 3);
716     trace!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
717     trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
718     trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
719     trace!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
720 }
721 
722 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
723 #[test]
724 fn debug_with_parent() {
725     let p = span!(Level::TRACE, "im_a_parent!");
726     debug!(parent: &p, foo = ?3, bar.baz = %2, quux = false);
727     debug!(parent: &p, foo = 3, bar.baz = 2, quux = false);
728     debug!(parent: &p, foo = 3, bar.baz = 3,);
729     debug!(parent: &p, "foo");
730     debug!(parent: &p, "foo: {}", 3);
731     debug!(parent: &p, { foo = 3, bar.baz = 80 }, "quux");
732     debug!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
733     debug!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
734     debug!(parent: &p, { foo = 2, bar.baz = 78 }, "quux");
735     debug!(parent: &p, { foo = ?2, bar.baz = %78 }, "quux");
736     debug!(target: "foo_events", parent: &p, foo = 3, bar.baz = 2, quux = false);
737     debug!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
738     debug!(target: "foo_events", parent: &p, "foo");
739     debug!(target: "foo_events", parent: &p, "foo: {}", 3);
740     debug!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
741     debug!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
742     debug!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
743     debug!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
744 }
745 
746 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
747 #[test]
748 fn info_with_parent() {
749     let p = span!(Level::TRACE, "im_a_parent!");
750     info!(parent: &p, foo = ?3, bar.baz = %2, quux = false);
751     info!(parent: &p, foo = 3, bar.baz = 2, quux = false);
752     info!(parent: &p, foo = 3, bar.baz = 3,);
753     info!(parent: &p, "foo");
754     info!(parent: &p, "foo: {}", 3);
755     info!(parent: &p, { foo = 3, bar.baz = 80 }, "quux");
756     info!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
757     info!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
758     info!(parent: &p, { foo = 2, bar.baz = 78 }, "quux");
759     info!(parent: &p, { foo = ?2, bar.baz = %78 }, "quux");
760     info!(target: "foo_events", parent: &p, foo = 3, bar.baz = 2, quux = false);
761     info!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
762     info!(target: "foo_events", parent: &p, "foo");
763     info!(target: "foo_events", parent: &p, "foo: {}", 3);
764     info!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
765     info!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
766     info!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
767     info!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
768 }
769 
770 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
771 #[test]
772 fn warn_with_parent() {
773     let p = span!(Level::TRACE, "im_a_parent!");
774     warn!(parent: &p, foo = ?3, bar.baz = %2, quux = false);
775     warn!(parent: &p, foo = 3, bar.baz = 2, quux = false);
776     warn!(parent: &p, foo = 3, bar.baz = 3,);
777     warn!(parent: &p, "foo");
778     warn!(parent: &p, "foo: {}", 3);
779     warn!(parent: &p, { foo = 3, bar.baz = 80 }, "quux");
780     warn!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
781     warn!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
782     warn!(parent: &p, { foo = 2, bar.baz = 78 }, "quux");
783     warn!(parent: &p, { foo = ?2, bar.baz = %78 }, "quux");
784     warn!(target: "foo_events", parent: &p, foo = 3, bar.baz = 2, quux = false);
785     warn!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
786     warn!(target: "foo_events", parent: &p, "foo");
787     warn!(target: "foo_events", parent: &p, "foo: {}", 3);
788     warn!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
789     warn!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
790     warn!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
791     warn!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
792 }
793 
794 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
795 #[test]
796 fn error_with_parent() {
797     let p = span!(Level::TRACE, "im_a_parent!");
798     error!(parent: &p, foo = ?3, bar.baz = %2, quux = false);
799     error!(parent: &p, foo = 3, bar.baz = 2, quux = false);
800     error!(parent: &p, foo = 3, bar.baz = 3,);
801     error!(parent: &p, "foo");
802     error!(parent: &p, "foo: {}", 3);
803     error!(parent: &p, { foo = 3, bar.baz = 80 }, "quux");
804     error!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
805     error!(parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
806     error!(parent: &p, { foo = 2, bar.baz = 78 }, "quux");
807     error!(parent: &p, { foo = ?2, bar.baz = %78 }, "quux");
808     error!(target: "foo_events", parent: &p, foo = 3, bar.baz = 2, quux = false);
809     error!(target: "foo_events", parent: &p, foo = 3, bar.baz = 3,);
810     error!(target: "foo_events", parent: &p, "foo");
811     error!(target: "foo_events", parent: &p, "foo: {}", 3);
812     error!(target: "foo_events", parent: &p, { foo = 3, bar.baz = 80 }, "quux");
813     error!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}", true);
814     error!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 79 }, "quux {:?}, {quux}", true, quux = false);
815     error!(target: "foo_events", parent: &p, { foo = 2, bar.baz = 78, }, "quux");
816 }
817 
818 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
819 #[test]
820 fn field_shorthand_only() {
821     #[derive(Debug)]
822     struct Position {
823         x: f32,
824         y: f32,
825     }
826     let pos = Position {
827         x: 3.234,
828         y: -1.223,
829     };
830 
831     trace!(?pos.x, ?pos.y);
832     debug!(?pos.x, ?pos.y);
833     info!(?pos.x, ?pos.y);
834     warn!(?pos.x, ?pos.y);
835     error!(?pos.x, ?pos.y);
836     event!(Level::TRACE, ?pos.x, ?pos.y);
837 }
838 
839 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
840 #[test]
841 fn borrow_val_events() {
842     // Reproduces https://github.com/tokio-rs/tracing/issues/954
843     let mut foo = (String::new(), String::new());
844     let zero = &mut foo.0;
845     trace!(one = ?foo.1);
846     debug!(one = ?foo.1);
847     info!(one = ?foo.1);
848     warn!(one = ?foo.1);
849     error!(one = ?foo.1);
850     zero.push_str("hello world");
851 }
852 
853 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
854 #[test]
855 fn borrow_val_spans() {
856     // Reproduces https://github.com/tokio-rs/tracing/issues/954
857     let mut foo = (String::new(), String::new());
858     let zero = &mut foo.0;
859     let _span = trace_span!("span", one = ?foo.1);
860     let _span = debug_span!("span", one = ?foo.1);
861     let _span = info_span!("span", one = ?foo.1);
862     let _span = warn_span!("span", one = ?foo.1);
863     let _span = error_span!("span", one = ?foo.1);
864     zero.push_str("hello world");
865 }
866 
867 #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
868 #[test]
869 fn callsite_macro_api() {
870     // This test should catch any inadvertent breaking changes
871     // caused by changes to the macro.
872     let _callsite = callsite! {
873         name: "test callsite",
874         kind: tracing::metadata::Kind::EVENT,
875         target: "test target",
876         level: tracing::Level::TRACE,
877         fields: foo, bar,
878     };
879     let _callsite = callsite! {
880         name: "test callsite",
881         kind: tracing::metadata::Kind::SPAN,
882         level: tracing::Level::TRACE,
883         fields: foo,
884     };
885     let _callsite = callsite! {
886         name: "test callsite",
887         kind: tracing::metadata::Kind::SPAN,
888         fields: foo,
889     };
890 }
891