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