Skip to content

v1.3.21

Compare
Choose a tag to compare
@zhuxiujia zhuxiujia released this 03 Jan 11:11
· 536 commits to master since this release

v1.3.21

  • add log format
/// format record data
pub trait RecordFormat: Send {
    fn do_format(&self, arg: &mut FastLogRecord);
}
pub struct FastLogFormatRecord {}

impl RecordFormat for FastLogFormatRecord {
    fn do_format(&self, arg: &mut FastLogRecord) {
        let data;
        let now = format!("{:36}", arg.now.to_string());
        match arg.level {
            Level::Warn | Level::Error => {
                data = format!("{} {} {} - {}  {}\n", &now, arg.level, arg.module_path, arg.args, arg.format_line());
            }
            _ => {
                data = format!("{} {} {} - {}\n", &now, arg.level, arg.module_path, arg.args);
            }
        }
        arg.formated = data;
    }
}