Function log::set_logger_raw
[−]
[src]
pub unsafe fn set_logger_raw<M>(make_logger: M) -> Result<(), SetLoggerError> where
M: FnOnce(MaxLogLevelFilter) -> *const Log,
Sets the global logger from a raw pointer.
This function is similar to set_logger
except that it is usable in
no_std
code.
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_raw
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_raw
internally.
Safety
The pointer returned by make_logger
must remain valid for the entire
duration of the program or until shutdown_logger_raw
is called. In
addition, shutdown_logger
must not be called after this function.