Skip to main content

error

Macro error 

Source
macro_rules! error {
    (logger: $logger:expr, target: $target:expr, $($arg:tt)+) => { ... };
    (logger: $logger:expr, $($arg:tt)+) => { ... };
    (target: $target:expr, $($arg:tt)+) => { ... };
    ($($arg:tt)+) => { ... };
}
Expand description

Logging (docs/logging.md). day::info!("…") and friends are the log crate’s macros, re-exported so an app needs no log dependency of its own for the common case. Because they are log’s, anything that speaks log (env_logger, tracing-log, a hand-written log::Log) works without adapters.

Day installs a default logger at launch, so these come out with no setup on every platform: stderr natively, the browser console on web-dom. An app that wants something else calls log::set_logger (or env_logger::init()) before day::launch and keeps it. Logs a message at the error level.

§Examples

use log::error;

let (err_info, port) = ("No connection", 22);

error!("Error: {err_info} on port {port}");
error!(target: "app_events", "App Error: {err_info}, Port: {port}");
error!(logger: my_logger, "App Error: {err_info}, Port: {port}");