pub struct LogSettings {
pub tracing_level: String,
pub pretty_log: Option<bool>,
pub journald: Option<bool>,
}Expand description
Log related settings.
§Description
This application outputs logs to a file by default. The file’s name and path is set via [LogSettings::log_output_file]. Output messages are append to the file if it exists previously. Use logrotate or any other application to avoid ending with an enormous log file.
Aside from that file, the application allows to output log messages to stdout as well, useful for debugging sessions. This feature is enabled via [LogSettings::enable_console_log].
Finally, the severity of the log messages to the console (when enabled) is also configurable, thus it is allowed to set different severity levels for the regular file log and the console log. This might be useful to avoid cluttering the console output with too much information that could be read from the logfile.
Fields§
§tracing_level: StringSee tracing::Level. Accepted values are specified at LogSettings::get_verbosity_level.
pretty_log: Option<bool>Enable console log output.
journald: Option<bool>Is the application running by systemd? If so, log to journald.
Implementations§
Source§impl LogSettings
impl LogSettings
Sourcepub fn get_verbosity_level(&self) -> LevelFilter
pub fn get_verbosity_level(&self) -> LevelFilter
Get the chosen verbosity level as a [LevelFilter] object.
§Description
Translate the tracing level that is given via a configuration file into a
[LevelFilter] object. Such object can be passed straight to a Subscriber to
specify a filter for the log messages.
Accepted values:
debugordbgto set the verbiosity toDEBUG.infoto set the verbosity toINFO.errororerrto set the verbosity toERROR.traceto set the verbosity toTRACE.warnor any other string to set the verbosity toWARN.
Trait Implementations§
Source§impl Clone for LogSettings
impl Clone for LogSettings
Source§fn clone(&self) -> LogSettings
fn clone(&self) -> LogSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LogSettings
impl Debug for LogSettings
Source§impl<'de> Deserialize<'de> for LogSettings
impl<'de> Deserialize<'de> for LogSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for LogSettings
impl RefUnwindSafe for LogSettings
impl Send for LogSettings
impl Sync for LogSettings
impl Unpin for LogSettings
impl UnwindSafe for LogSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more