pub fn set_vlogger(vlogger: &'static dyn VLog) -> Result<(), SetVLoggerError>Expand description
Sets the global vlogger to a &'static VLog.
This function may only be called once in the lifetime of a program. Any vlog
events that occur before the call to set_vlogger completes will be ignored.
This function does not typically need to be called manually. VLogger implementations should provide an initialization method that installs the vlogger internally.
§Availability
This method is available even when the std feature is disabled. However,
it is currently unavailable on thumbv6 targets, which lack support for
some atomic operations which are used by this function. Even on those
targets, set_vlogger_racy will be available.
§Errors
An error is returned if a vlogger has already been set.
§Examples
ⓘ
use v_log::{message, Record, Metadata};
static MY_VLOGGER: MyVLogger = MyVLogger;
struct MyVLogger;
impl v_log::VLog for MyVLogger {...}
v_log::set_vlogger(&MY_VLOGGER).unwrap();
message!("hello vlog");