Logging #26
@ -3,6 +3,7 @@
|
||||
*/
|
||||
#![allow(clippy::module_name_repetitions)]
|
||||
use std::cmp::Ordering;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::log::LogVerbosity::Warning;
|
||||
|
||||
@ -31,6 +32,7 @@ pub struct LogSettings
|
||||
/// Logs location in code, where the message was logged, if true.<br>
|
||||
location: bool,
|
||||
/// If `Some(path)` tries to also write the log to `path` in addition to stderr/stderr.<br>
|
||||
#[getset(skip)]
|
||||
path: Option<PathBuf>,
|
||||
/// Logs to standard out, if true.<br>
|
||||
stdout: bool,
|
||||
@ -38,6 +40,22 @@ pub struct LogSettings
|
||||
stderr: bool,
|
||||
}
|
||||
|
||||
impl LogSettings
|
||||
{
|
||||
/// Setter for log path, including syntactic sugar for the [Option] enum.
|
||||
pub fn set_path(&mut self, path: impl Into<Option<PathBuf>>)
|
||||
{
|
||||
self.path = path.into();
|
||||
}
|
||||
|
||||
/// Getter for the log path.
|
||||
#[must_use]
|
||||
pub fn path(&self) -> Option<&Path>
|
||||
{
|
||||
self.path.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for LogSettings
|
||||
{
|
||||
fn default() -> Self
|
||||
|
Reference in New Issue
Block a user