deno_print 0.5.0

Print macros that don't panic on broken pipes, for Deno crates
Documentation

Replacements for the std print!, println!, eprint! and eprintln! macros that drop write errors instead of panicking, named after Cargo's macros with the same semantics.

The Rust runtime ignores SIGPIPE, so when the other end of a pipe is closed (ex. deno test | head) writes to stdout surface as EPIPE errors, which make the std print macros panic. The macros in this crate drop write errors instead, matching how Node.js treats EPIPE on stdout and how env_logger treats write errors.

use deno_print::drop_println;

drop_println!("hello there");

Use these macros for output that is the program's deliverable and must go to stdout (ex. subcommand reporters). For diagnostic output prefer the log crate, which is also tolerant to write errors and integrates with the progress bar and telemetry.

See https://github.com/denoland/deno/issues/15767