Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a macro for print in debug mode only #2267

Closed
3442853561 opened this issue Dec 27, 2017 · 2 comments
Closed

Add a macro for print in debug mode only #2267

3442853561 opened this issue Dec 27, 2017 · 2 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.

Comments

@3442853561
Copy link

I not sure is RFC #2173 include this issue, or not.

macro_rules! debug {
    ($($arg:tt)*) => { 
        if cfg!(debug_assertions) {
            print!($($arg)*);
        }
    };
}

fn main() {
    debug!("test");
}
@3442853561 3442853561 changed the title Add a macros for print in debug mode only Add a macro for print in debug mode only Dec 27, 2017
@Centril
Copy link
Contributor

Centril commented Dec 27, 2017

It does (and more), but to STDERR instead of STDOUT. Read the RFC on a motivation of why.

@Centril Centril added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Dec 27, 2017
@Centril
Copy link
Contributor

Centril commented Apr 26, 2018

I'll go ahead and close this one since I think it is sufficiently close to dbg! (latest RFC: #2361).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

2 participants