Skip to content

Commit

Permalink
Multithreaded logging
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Nov 7, 2020
1 parent 3cd9d0e commit 57032fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fast_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use chrono::{DateTime, Local};
use crossbeam_channel::{Receiver, SendError};
use log::{Level, LevelFilter, Metadata, Record};

use crate::error::LogError;
use crate::filter::{Filter, NoFilter};
use crate::plugin::console::ConsoleAppender;
use crate::plugin::file::FileAppender;
Expand Down Expand Up @@ -181,6 +182,9 @@ pub fn init_split_log(log_dir_path: &str, channel_cup: usize, log_cup: u64, allo
}

pub fn init_custom_log(appenders: Vec<Box<dyn LogAppender>>, log_cup: usize, level: log::Level, filter: Box<dyn Filter>) -> Result<(), Box<dyn std::error::Error + Send>> {
if appenders.is_empty() {
return Err(Box::new(LogError::from("[fast_log] appenders can not be empty!")));
}
let main_recv = set_log(RuntimeType::Std, log_cup, level, filter);
if appenders.len() == 1 {
//main recv data
Expand Down

0 comments on commit 57032fd

Please sign in to comment.