pub fn create_logger<P: AsRef<Path>>(
    log_file_name: P,
    log_term: bool,
) -> Result<Logger, WorkerError> {
    //Make sure the full path is valid
    if let Some(parent) = log_file_name.as_ref().parent() {
        std::fs::create_dir_all(parent).expect("Could not create log directory structure");
    }

    let log_file = OpenOptions::new()
        .create(true)
        .write(true)
        .truncate(true)
        .open(log_file_name)?;

    if log_term {
        create_term_and_file_logger(log_file)
    } else {
        create_file_logger(log_file)
    }
}
/// Create a duplicate logger for the terminal and the file passed as parameter.
Create a duplicate logger for the terminal and the file passed as parameter.
Create a duplicate logger for the terminal and the file passed as parameter .
pub fn create_logger<P: AsRef<Path>>(
    log_file_name: P,
    log_term: bool,
) -> Result<Logger, WorkerError> {
    //Make sure the full path is valid
    if let Some(parent) = log_file_name.as_ref().parent() {
        std::fs::create_dir_all(parent).expect("Could not create log directory structure");
    }
    let log_file = OpenOptions::new()
        .create(true)
        .write(true)
        .truncate(true)
        .open(log_file_name)?;
    if log_term {
        create_term_and_file_logger(log_file)
    } else {
        create_file_logger(log_file)
    }
}
pub fn create_logger < P : AsRef < Path > > ( log_file_name : P , log_term : bool , ) -> Result < Logger , WorkerError > { //Make sure the full path is valid if let Some ( parent ) = log_file_name . as_ref ( ) . parent ( ) { std :: fs :: create_dir_all ( parent ) . expect ( " " ) ; } let log_file = OpenOptions :: new ( ) . create ( true ) . write ( true ) . truncate ( true ) . open ( log_file_name ) ? ; if log_term { create_term_and_file_logger ( log_file ) } else { create_file_logger ( log_file ) } }
Create a duplicate logger for the terminal and the file passed as parameter.
Create a duplicate logger for the terminal and the file passed as parameter .
log_file_name
P
log_term
bool