Skip to main content

init_logging

Function init_logging 

Source
pub fn init_logging()
Expand description

Install Day’s default logger and level, unless the app already installed its own.

Called from launch_with, so logging works with no ceremony at all: an app writes log::info!(…) (or day::info!, the same macro re-exported through the prelude) and the line comes out on every platform. set_logger answers Err when a logger is already registered; that is all the customization there is, and why the error is ignored: an app that called env_logger::init() (or installed tracing, or its own log::Log) before day::launch keeps it, and Day does not fight for the slot.

The default level is Debug in a debug build and Info in a release one; DAY_LOG overrides it with a level name (off/error/warn/info/debug/trace). Reading an environment variable is a native-only affordance; on the web there is no process environment, so the launch path sets the level explicitly from the page’s query string instead.