add literal print to debug!

embed
Manos Pitsidianakis 2019-05-07 01:54:20 +03:00
parent 99527f5684
commit 325bb5bff2
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 15 additions and 0 deletions

View File

@ -22,6 +22,21 @@
pub mod dbg {
#[macro_export]
macro_rules! debug {
($val:literal) => {
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
std::thread::current()
.name()
.map(|v| v.to_string())
.unwrap_or_else(|| format!("{:?}", std::thread::current().id())),
file!(),
line!(),
column!()
);
eprintln!($val);
}
};
($val:expr) => {
if cfg!(debug_assertions) {
eprint!(