# Function log::set_logger [−] [src]

    pub fn set_logger<M>(make_logger: M) -> Result<(), SetLoggerError> where
        M: FnOnce(MaxLogLevelFilter) -> Box<Log>,

Sets the global logger.

The `make_logger` closure is passed a `MaxLogLevel` object, which the logger should use to keep the global maximum log level in sync with the highest log level that the logger will not ignore.

This function may only be called once in the lifetime of a program. Any log events that occur before the call to `set_logger` completes will be ignored.

This function does not typically need to be called manually. Logger implementations should provide an initialization method that calls `set_logger` internally.

Requires the `use_std` feature (enabled by default).

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)