Skip to content

Commit

Permalink
Merge pull request #76 from zeroflaw/master
Browse files Browse the repository at this point in the history
add write thread name support for termlog
  • Loading branch information
Drakulix committed May 11, 2021
2 parents adeb9cb + 60001e1 commit ea98623
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/loggers/termlog.rs
Expand Up @@ -9,7 +9,7 @@ use termcolor::{ColorChoice, ColorSpec, StandardStream, WriteColor};

use super::logging::*;

use crate::{Config, SharedLogger};
use crate::{Config, SharedLogger, ThreadLogMode};

enum StdTerminal {
Stderr(Box<dyn WriteColor + Send>),
Expand Down Expand Up @@ -155,7 +155,14 @@ impl TermLogger {
}

if self.config.thread <= record.level() && self.config.thread != LevelFilter::Off {
write_thread_id(&mut *term_lock, &self.config)?;
match self.config.thread_log_mode {
ThreadLogMode::IDs => {
write_thread_id(&mut *term_lock, &self.config)?;
}
ThreadLogMode::Names | ThreadLogMode::Both => {
write_thread_name(&mut *term_lock, &self.config)?;
}
}
}

if self.config.target <= record.level() && self.config.target != LevelFilter::Off {
Expand Down

0 comments on commit ea98623

Please sign in to comment.