add literal print to debug!

This commit is contained in:
Manos Pitsidianakis 2019-05-07 01:54:20 +03:00
parent 99527f5684
commit 325bb5bff2
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

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!(