init

Function init 

Source
pub fn init()
Expand description

Initializes a new logger. It logs to stderr.

The default format is:

<timestamp>\t<log-level>\t<module-name>\t<source-file>:<line-number>\t<log-message>

If the environment variable GOLOG_LOG_FMT=json is set, then the output is formatted as JSON:

{
  "level": "<log-level>",
  "ts":"<timestamp>",
  "logger":"<module-name>",
  "caller":"<source-file>:<line-number>",
  "msg":"<log-message>"
}

ยงPanics

Panics if a global logger was already set or the value of RUST_LOG is malformed.

Examples found in repository?
examples/simple.rs (line 35)
34fn main() {
35    fil_logger::init();
36
37    trace!("logging on trace level");
38    debug!("logging on debug level");
39    info!("logging on into level");
40    warn!("logging on warn level");
41    error!("logging on error level");
42
43    info!(r#"logging string with json: {{"hello": true}}"#);
44}