summaryrefslogtreecommitdiff
path: root/src/log.rs
blob: 5b1575ea648a0c73af6db196a73010f1a1a587b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Helper macros for logging

/// Log to standard error, only compiled when in debug mode.
#[macro_export]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        {
            eprintln!($($e),*);
        }
    };
}

/// Log a request / cookie when `debug_assertions` are on
#[macro_export]
macro_rules! debug_req {
    ($req:ident) => {
        $crate::debug!("seq ?: {:?}", $req)
    };
    ($req:ident, $cookie:ident) => {
        use xcb::Cookie;
        $crate::debug!("seq {}: {:?}", $cookie.sequence(), $req)
    };
}