Add padding to logger
This commit is contained in:
parent
ba21b86435
commit
13b5d1e58f
2 changed files with 6 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ pub struct DecoratingPipe {
|
|||
|
||||
impl DecoratingPipe {
|
||||
pub fn new(plugin_name: &str) -> DecoratingPipe {
|
||||
info!("Creating decorating pipe!");
|
||||
info!("Creating decorating pipe for plugin: {}!", plugin_name);
|
||||
DecoratingPipe {
|
||||
buffer: VecDeque::new(),
|
||||
plugin_name: String::from(plugin_name),
|
||||
|
|
@ -70,11 +70,11 @@ impl Write for DecoratingPipe {
|
|||
if split_converted_buffer.peek().is_none() {
|
||||
// Log last chunk iff the last char is endline. Otherwise do not do it.
|
||||
if converted_buffer.chars().last().unwrap() == '\n' && !msg.is_empty() {
|
||||
info!("{}: {}", self.plugin_name, msg);
|
||||
info!("|{:<25}| {}", self.plugin_name, msg);
|
||||
consumed_bytes += msg.len() + 1;
|
||||
}
|
||||
} else {
|
||||
info!("{}: {}", self.plugin_name, msg);
|
||||
info!("|{:<25}| {}", self.plugin_name, msg);
|
||||
consumed_bytes += msg.len() + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
refresh_rate: 30 seconds
|
||||
|
||||
appenders:
|
||||
# An appender named "stdout" that writes to stdout
|
||||
# An appender named "stderr" that writes to stderr
|
||||
stderr:
|
||||
kind: console
|
||||
target: stderr
|
||||
|
|
@ -14,7 +14,8 @@ appenders:
|
|||
append: false
|
||||
encoder:
|
||||
# {n} means platform dependent newline
|
||||
pattern: "|{module}| {date} {highlight({level})} [{thread}] [{file}:{line}]: {message} {n}"
|
||||
# module is padded to *at least* 25 bytes and thread is padded to be between 10 and 15 bytes.
|
||||
pattern: "|{module:<25}| {date} {highlight({level})} [{thread:<10.15}] [{file}:{line}]: {message} {n}"
|
||||
|
||||
# plugin appender. To be used in decorating_pipe to forward stderr output from plugins.
|
||||
logPlugin:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue