moved out format_log_record and renamed var to RUST_VERBOSE_PATH
@@ -149,8 +149,7 @@ fn has_colors() -> bool {
}
}
-pub fn init_logger() -> Result<(), SetLoggerError> {
- let format = |record: &LogRecord| {
+fn format_log_record(record: &LogRecord) -> String {
let ts = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let secs = ts.as_secs().to_string();
let millis = (ts.subsec_nanos() as u64 / 1000000).to_string();
@@ -160,7 +159,7 @@ pub fn init_logger() -> Result<(), SetLoggerError> {
let line = record.location().line();
let source_path;
- let verbose_src_path = match env::var("LOG_VERBOSE_SRC_FILE_LINE") {
+ let verbose_src_path = match env::var("RUST_VERBOSE_PATH") {
Ok(val) => val.parse::<bool>().unwrap_or(false),
Err(_) => false,
};
@@ -199,10 +198,11 @@ pub fn init_logger() -> Result<(), SetLoggerError> {
&source_path,
record.args())
}
- };
+}
+pub fn init_logger() -> Result<(), SetLoggerError> {
let mut builder = LogBuilder::new();
- builder.format(format);
+ builder.format(format_log_record);
if env::var("RUST_LOG").is_ok() {
builder.parse(&env::var("RUST_LOG").unwrap());
