Skip to main content

info

Macro info 

Source
macro_rules! info {
    (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 info level.

§Examples

use log::info;

let conn_info = Connection { port: 40, speed: 3.20 };

info!("Connected to port {} at {} Mb/s", conn_info.port, conn_info.speed);
info!(
    target: "connection_events",
    "Successful connection, port: {}, speed: {}",
    conn_info.port, conn_info.speed
);
info!(
    logger: my_logger,
    "Successful connection, port: {}, speed: {}",
    conn_info.port, conn_info.speed
);