pub(crate) fn initialize_logger(&self) {
        // Allow optionally controlling debug output level
        let debug_level;
        match self.configuration.verbose {
            0 => debug_level = LevelFilter::Warn,
            1 => debug_level = LevelFilter::Info,
            2 => debug_level = LevelFilter::Debug,
            _ => debug_level = LevelFilter::Trace,
        }

        // Set log level based on run-time option or default if set.
        let log_level_value = if self.configuration.log_level > 0 {
            self.configuration.log_level
        } else if let Some(default_log_level) = self.defaults.log_level {
            default_log_level
        } else {
            0
        };
        let log_level = match log_level_value {
            0 => LevelFilter::Warn,
            1 => LevelFilter::Info,
            2 => LevelFilter::Debug,
            _ => LevelFilter::Trace,
        };

        let swanling_log: Option<PathBuf>;
        // Use --log-file if set.
        if !self.configuration.swanling_log.is_empty() {
            swanling_log = Some(PathBuf::from(&self.configuration.swanling_log));
        }
        // Otherwise use swanling_attack.defaults.swanling_log if set.
        else if let Some(default_swanling_log) = &self.defaults.swanling_log {
            swanling_log = Some(PathBuf::from(default_swanling_log));
        }
        // Otherwise disable the log.
        else {
            swanling_log = None;
        }

        if let Some(log_to_file) = swanling_log {
            match CombinedLogger::init(vec![
                SimpleLogger::new(debug_level, Config::default()),
                WriteLogger::new(
                    log_level,
                    Config::default(),
                    std::fs::File::create(&log_to_file).unwrap(),
                ),
            ]) {
                Ok(_) => (),
                Err(e) => {
                    info!("failed to initialize CombinedLogger: {}", e);
                }
            }
            info!("Writing to log file: {}", log_to_file.display());
        } else {
            match CombinedLogger::init(vec![SimpleLogger::new(debug_level, Config::default())]) {
                Ok(_) => (),
                Err(e) => {
                    info!("failed to initialize CombinedLogger: {}", e);
                }
            }
        }

        info!("Output verbosity level: {}", debug_level);
        info!("Logfile verbosity level: {}", log_level);
    }
/// Optionally initialize the logger which writes to standard out and/or to
/// a configurable log file.
///
/// This method is invoked by
/// [`SwanlingAttack.execute()`](./struct.SwanlingAttack.html#method.execute).
Optionally initialize the logger which writes to standard out and/or to
a configurable log file.


Optionally initialize the logger which writes to standard out and / or to a configurable log file .
pub(crate) fn initialize_logger(&self) {
        // Allow optionally controlling debug output level
        let debug_level;
        match self.configuration.verbose {
            0 => debug_level = LevelFilter::Warn,
            1 => debug_level = LevelFilter::Info,
            2 => debug_level = LevelFilter::Debug,
            _ => debug_level = LevelFilter::Trace,
        }
        // Set log level based on run-time option or default if set.
        let log_level_value = if self.configuration.log_level > 0 {
            self.configuration.log_level
        } else if let Some(default_log_level) = self.defaults.log_level {
            default_log_level
        } else {
            0
        };
        let log_level = match log_level_value {
            0 => LevelFilter::Warn,
            1 => LevelFilter::Info,
            2 => LevelFilter::Debug,
            _ => LevelFilter::Trace,
        };
        let swanling_log: Option<PathBuf>;
        // Use --log-file if set.
        if !self.configuration.swanling_log.is_empty() {
            swanling_log = Some(PathBuf::from(&self.configuration.swanling_log));
        }
        // Otherwise use swanling_attack.defaults.swanling_log if set.
        else if let Some(default_swanling_log) = &self.defaults.swanling_log {
            swanling_log = Some(PathBuf::from(default_swanling_log));
        }
        // Otherwise disable the log.
        else {
            swanling_log = None;
        }
        if let Some(log_to_file) = swanling_log {
            match CombinedLogger::init(vec![
                SimpleLogger::new(debug_level, Config::default()),
                WriteLogger::new(
                    log_level,
                    Config::default(),
                    std::fs::File::create(&log_to_file).unwrap(),
                ),
            ]) {
                Ok(_) => (),
                Err(e) => {
                    info!("failed to initialize CombinedLogger: {}", e);
                }
            }
            info!("Writing to log file: {}", log_to_file.display());
        } else {
            match CombinedLogger::init(vec![SimpleLogger::new(debug_level, Config::default())]) {
                Ok(_) => (),
                Err(e) => {
                    info!("failed to initialize CombinedLogger: {}", e);
                }
            }
        }
        info!("Output verbosity level: {}", debug_level);
        info!("Logfile verbosity level: {}", log_level);
    }
pub ( crate ) fn initialize_logger ( & self ) { // Allow optionally controlling debug output level let debug_level ; match self . configuration . verbose { 0 => debug_level = LevelFilter :: Warn , 1 => debug_level = LevelFilter :: Info , 2 => debug_level = LevelFilter :: Debug , _ => debug_level = LevelFilter :: Trace , } // Set log level based on run-time option or default if set. let log_level_value = if self . configuration . log_level > 0 { self . configuration . log_level } else if let Some ( default_log_level ) = self . defaults . log_level { default_log_level } else { 0 } ; let log_level = match log_level_value { 0 => LevelFilter :: Warn , 1 => LevelFilter :: Info , 2 => LevelFilter :: Debug , _ => LevelFilter :: Trace , } ; let swanling_log : Option < PathBuf > ; // Use --log-file if set. if ! self . configuration . swanling_log . is_empty ( ) { swanling_log = Some ( PathBuf :: from ( & self . configuration . swanling_log ) ) ; } // Otherwise use swanling_attack.defaults.swanling_log if set. else if let Some ( default_swanling_log ) = & self . defaults . swanling_log { swanling_log = Some ( PathBuf :: from ( default_swanling_log ) ) ; } // Otherwise disable the log. else { swanling_log = None ; } if let Some ( log_to_file ) = swanling_log { match CombinedLogger :: init ( vec ! [ SimpleLogger new ( debug_level Config default ( ) ) WriteLogger new ( log_level Config default ( ) std fs File create ( log_to_file ) unwrap ( ) ) ] ) { Ok ( _ ) => ( ) , Err ( e ) => { info ! ( " " e ) ; } } info ! ( " " log_to_file display ( ) ) ; } else { match CombinedLogger :: init ( vec ! [ SimpleLogger new ( debug_level Config default ( ) ) ] ) { Ok ( _ ) => ( ) , Err ( e ) => { info ! ( " " e ) ; } } } info ! ( " " debug_level ) ; info ! ( " " log_level ) ; }
Optionally initialize the logger which writes to standard out and/or to
a configurable log file.
Optionally initialize the logger which writes to standard out and / or to a configurable log file .
&self