Macro snapbox_macros::eprintln

source ·
macro_rules! eprintln {
    () => { ... };
    ($($arg:tt)*) => { ... };
}
Available on crate feature color only.
Expand description

Prints to stderr, with a newline.

Equivalent to the println! macro, except that output goes to stderr instead of stdout. See println! for example usage.

Use eprintln! only for error and progress messages. Use println! instead for the primary output of your program.

NOTE: Not all eprintln! calls will be captured in tests like std::eprintln!

  • Capturing will automatically be activated in test binaries
  • Otherwise, only when the test feature is enabled

§Panics

Panics if writing to stderr fails for any reason except broken pipe.

Writing to non-blocking stdout can cause an error, which will lead this macro to panic.

§Examples

use anstream::eprintln;

eprintln!("Error: Could not complete task");