clap_logflag/
config.rs

1use std::path::PathBuf;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum LoggingConfig {
5    // TODO It might be better to remove LoggingDisabled and instead represent it as an empty destination vector.
6    LoggingDisabled,
7    LoggingEnabled {
8        destinations: Vec<LogDestinationConfig>,
9    },
10}
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum LogDestination {
14    /// Log to stderr
15    Stderr,
16
17    /// Log to the file at the given path
18    File(PathBuf),
19
20    /// Log to the system log
21    Syslog,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq)]
25pub struct LogDestinationConfig {
26    pub destination: LogDestination,
27
28    /// Only log messages at this level or higher to this destination.
29    ///
30    /// If `None`, the default level is used.
31    pub level: Option<log::LevelFilter>,
32}