pub fn init()Expand description
Initialize logging with sensible defaults.
- Log level from
RUNI_LOGenv var (default:info) - Uni-style format:
timestamp LEVEL [target] message - (file:line) - Colored output for terminals, JSON for non-terminals
Examples found in repository?
examples/hello_log.rs (line 4)
3fn main() {
4 runi_log::init();
5
6 info!("Runi started");
7 debug!(version = "0.1.0", "loading config");
8 warn!(retries = 3, "connection slow");
9
10 let span = span!(Level::INFO, "request", method = "GET", path = "/api");
11 let _guard = span.enter();
12 info!("handling request");
13 error!("something went wrong");
14}