1use std::sync::atomic::{AtomicBool, Ordering};
6
7static QUIET_MODE: AtomicBool = AtomicBool::new(false);
9
10pub fn set_quiet(quiet: bool) {
12 QUIET_MODE.store(quiet, Ordering::SeqCst);
13}
14
15pub fn is_quiet() -> bool {
17 QUIET_MODE.load(Ordering::SeqCst)
18}
19
20pub fn print_info(args: std::fmt::Arguments<'_>) {
23 if !is_quiet() {
24 eprintln!("{}", args);
25 }
26}
27
28#[allow(dead_code)] pub fn print_warn(args: std::fmt::Arguments<'_>) {
31 if !is_quiet() {
32 eprintln!("{}", args);
33 }
34}
35
36#[macro_export]
38macro_rules! info_print {
39 ($($arg:tt)*) => {
40 $crate::output::print_info(format_args!($($arg)*));
41 };
42}
43
44#[macro_export]
46macro_rules! warn_print {
47 ($($arg:tt)*) => {
48 $crate::output::print_warn(format_args!($($arg)*));
49 };
50}