fn write_log(&self, mut msg: String, msg_level: Level) {
        let mut guard;
        let mut dest: Box<dyn Write + Send> = if self.init.is_initialized() {
            guard = extract_guard(self.log_buf.lock());
            Box::new(guard.as_mut())
        } else {
            match msg_level {
                Level::Error | Level::Warn => Box::new(stderr()),
                _ => Box::new(stdout()),
            }
        };

        // No need to explicitly call flush because the underlying LineWriter flushes
        // automatically whenever a newline is detected (and we always end with a
        // newline the current write).
        msg.push('\n');
        if dest.write_all(msg.as_bytes()).is_err() {
            // No reason to log the error to stderr here, just increment the metric.
            METRICS.logger.missed_log_count.inc();
        }
    }
/// The `write_log` method takes care of the common logic involved in writing
/// regular log messages.
The `write_log` method takes care of the common logic involved in writing
regular log messages.
The ` write_log ` method takes care of the common logic involved in writing regular log messages .
fn write_log(&self, mut msg: String, msg_level: Level) {
        let mut guard;
        let mut dest: Box<dyn Write + Send> = if self.init.is_initialized() {
            guard = extract_guard(self.log_buf.lock());
            Box::new(guard.as_mut())
        } else {
            match msg_level {
                Level::Error | Level::Warn => Box::new(stderr()),
                _ => Box::new(stdout()),
            }
        };
        // No need to explicitly call flush because the underlying LineWriter flushes
        // automatically whenever a newline is detected (and we always end with a
        // newline the current write).
        msg.push('\n');
        if dest.write_all(msg.as_bytes()).is_err() {
            // No reason to log the error to stderr here, just increment the metric.
            METRICS.logger.missed_log_count.inc();
        }
    }
fn write_log ( & self , mut msg : String , msg_level : Level ) { let mut guard ; let mut dest : Box < dyn Write + Send > = if self . init . is_initialized ( ) { guard = extract_guard ( self . log_buf . lock ( ) ) ; Box :: new ( guard . as_mut ( ) ) } else { match msg_level { Level :: Error | Level :: Warn => Box :: new ( stderr ( ) ) , _ => Box :: new ( stdout ( ) ) , } } ; // No need to explicitly call flush because the underlying LineWriter flushes // automatically whenever a newline is detected (and we always end with a // newline the current write). msg . push ( '\n' ) ; if dest . write_all ( msg . as_bytes ( ) ) . is_err ( ) { // No reason to log the error to stderr here, just increment the metric. METRICS . logger . missed_log_count . inc ( ) ; } }
The `write_log` method takes care of the common logic involved in writing
regular log messages.
The ` write_log ` method takes care of the common logic involved in writing regular log messages .
&self
msg
String
msg_level
Level
&self
msg
String
msg_level
Level