-
Notifications
You must be signed in to change notification settings - Fork 13
/
config.rs
47 lines (44 loc) · 995 Bytes
/
config.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! This module contains the configuration options for the application.
//! # Examples:
//! ```
//! use cli_utils::config::Logging;
//! let config = Logging::new();
//! ```
//!
pub enum LogLevel {
Debug,
Info,
Warn,
Error,
}
pub enum LogOutput {
Stdout,
Stderr,
File(String),
}
/// This struct contains configuration options for the application.
/// # Examples:
/// ```
/// use cli_utils::config::Logging;
/// let config = Logging::new();
/// ```
///
/// Creating a new instance of the Logging struct:
/// ```
/// use cli_utils::config::{Logging, LogLevel, LogOutput};
/// let config = Logging{ enabled: true, level: LogLevel::Info, destination: LogOutput::Stdout };
/// ```
pub struct Logging {
pub enabled: bool,
pub level: LogLevel,
pub destination: LogOutput,
}
impl Logging {
pub fn new() -> Self {
Self {
enabled: false,
level: LogLevel::Info,
destination: LogOutput::Stdout,
}
}
}