telegraf
This commit is contained in:
+3
-4
@@ -55,13 +55,12 @@ mod warden;
|
||||
use std::thread::{spawn};
|
||||
use std::path::{Path};
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
use iron::prelude::*;
|
||||
use crossbeam_channel::{unbounded};
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct JsonLog {
|
||||
time: String,
|
||||
name: String,
|
||||
module: String,
|
||||
level: String,
|
||||
msg: String,
|
||||
}
|
||||
@@ -78,7 +77,7 @@ fn setup_logger() -> Result<(), fern::InitError> {
|
||||
let term = fern::Dispatch::new()
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{color_line}[{date}][{target}][{level}{color_line}] {message}\x1B[0m",
|
||||
"{color_line}{date} {target} {level}{color_line} {message}\x1B[0m",
|
||||
color_line = format_args!("\x1B[{}m", colors_line.get_color(&record.level()).to_fg_str()),
|
||||
date = chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
|
||||
target = record.target(),
|
||||
@@ -92,7 +91,7 @@ fn setup_logger() -> Result<(), fern::InitError> {
|
||||
.format(|out, message, record| {
|
||||
let json = JsonLog {
|
||||
time: chrono::Local::now().to_rfc3339(),
|
||||
name: record.target().to_string(),
|
||||
module: record.target().to_string(),
|
||||
level: record.level().to_string(),
|
||||
msg: message.to_string()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user