zolt/msg.rs
1//! Utilities for general CLI messaging.
2//!
3//! It's recommended to call these macros from the root of the crate instead of
4//! calling them from here. I.e. call [`crate::info!`] instead of
5//! [`crate::msg::info!`].
6//!
7//! # Message types
8//! There are four messaging types available:
9//! - Info: [`info!`], [`infoln!`], [`infofmt!`]
10//! - Warning: [`warn!`], [`warnln!`], [`warnfmt!`]
11//! - Error: [`err!`], [`errln!`], [`errfmt!`]
12//! - Debug: [`debug!`], [`debugln!`], [`debugfmt!`]
13//!
14//! # Macro types
15//! The first form of these macros ([`info!`], [`warn!`], [`err!`], [`debug!`])
16//! all behave like [`print!`] does - printing to the terminal *without* a
17//! newline.
18//!
19//! The second form of these macros ([`infoln!`], [`warnln!`], [`errln!`],
20//! [`debugln!`]) all behave line [`println!`] does - printing to the terminal
21//! *with* a newline.
22//!
23//! The last form of these macros ([`infofmt!`], [`warnfmt!`], [`errfmt!`],
24//! [`debugfmt!`]) all behave like [`format!`] does - returning the formatted
25//! string directly.
26//!
27//! # Message behavior
28//! The Info macros print to [`std::io::Stdout`], while all the rest print to [`std::io::Stderr`].
29//!
30//! If this behavior isn't desired, you can obtain the formatted string from the `*fmt` macros and
31//! then do whatever you need with them.
32//!
33//! # Coloring message contents
34//! The contents of messages can be colored by using [`colored::Colorize`], which is re-exported
35//! under `zolt::Colorize`:
36//!
37//! ```rust
38//! use zolt::Colorize;
39//!
40//! zolt::infoln!("Here's a message with {} output!", "colored".blue());
41//! ```
42#[doc(inline)]
43pub use zolt_macros::{
44 debug, debugfmt, debugln, err, errfmt, errln, info, infofmt, infoln, warn, warnfmt, warnln,
45};