1 // Licensed to the Apache Software Foundation (ASF) under one 2 // or more contributor license agreements. See the NOTICE file 3 // distributed with this work for additional information 4 // regarding copyright ownership. The ASF licenses this file 5 // to you under the Apache License, Version 2.0 (the 6 // "License"); you may not use this file except in compliance 7 // with the License. You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, 12 // software distributed under the License is distributed on an 13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 // KIND, either express or implied. See the License for the 15 // specific language governing permissions and limitations 16 // under the License. 17 18 /// Macro for printing to the trace output, without a newline. 19 /// 20 /// Equivalent to the `trace_println!` macro expect that a newline is not 21 /// printed at the end of the message. 22 /// 23 /// # Examples 24 /// 25 /// ``` no_run 26 /// trace_print!("this ") 27 /// trace_print!("will ") 28 /// trace_print!("be ") 29 /// trace_print!("on ") 30 /// trace_print!("the ") 31 /// trace_print!("same ") 32 /// trace_print!("line ") 33 /// print!("this string has a newline, why not choose println! instead?\n"); 34 /// ``` 35 #[macro_export] 36 macro_rules! trace_print { 37 ($($arg:tt)*) => ($crate::trace::Trace::_print(format_args!($($arg)*))); 38 } 39 40 /// Macro for printing to the trace output, with a newline. 41 /// Use the `format!` syntax to write data to the standard output. See 42 /// `std::fmt` for more information. 43 /// 44 /// # Examples 45 /// 46 /// ``` no_run 47 /// trace_println!("Hello, World!"); 48 /// trace_println!("format {} arguments", "some"); 49 /// ``` 50 #[macro_export] 51 macro_rules! trace_println { 52 () => { 53 $crate::trace::Trace::_print(format_args!("\n")); 54 }; 55 ($s:expr) => { 56 $crate::trace::Trace::_print(format_args!(concat!($s, "\n"))); 57 }; 58 ($s:expr, $($tt:tt)*) => { 59 $crate::trace::Trace::_print(format_args!(concat!($s, "\n"), $($tt)*)); 60 }; 61 } 62