Logging #26

Open
leon wants to merge 33 commits from Logging into main
2 changed files with 15 additions and 3 deletions
Showing only changes of commit 927a8d6d05 - Show all commits

View File

@ -1,5 +1,14 @@
/*! /*!
* Containing all singleton and thread-safe structs related to configuring `WANessa`. * Containing all singleton and thread-safe structs related to configuring `WANessa`.
*
* This crate differentiates between `Configs` and `Settings`:
* Configs:
* - Configs are immutable after they have been initialized. Example [`DbConfig`].
* - Changing the config requires a restart of `WANessa`.
*
* Settings:
* - Settings are mutable after they have been initialized. Example [`LogSettings`].
* - `WANessa` always uses the current setting and does not need a restart to apply new settings.
*/ */
pub mod db; pub mod db;

View File

@ -1,6 +1,6 @@
/*! /*!
* This module handles logging messages asynchronously and is thread-safe. * This module handles logging messages asynchronously and is thread-safe.
* It should mostly be called statically. * It should mostly be called statically using the [`log!`] macro.
*/ */
mod test; mod test;
@ -92,7 +92,10 @@ pub fn log_to_str(
} }
/** /**
* Shorthand version for [`log_message`], which does not require information about the [`config::Config::log_location`]. * Shorthand version for [`log_message`], which does not require information about where in the code
* the command was called from.
* Tries to aqcuire a read lock, if a reference to an instance of [`config::log::LogSettings`] is
* not given.
*/ */
#[macro_export] #[macro_export]
macro_rules! log { macro_rules! log {
@ -109,7 +112,7 @@ macro_rules! log {
} }
/** /**
* A named typle assigning a log [`LogVerbosity`] to a [`LogMessageType`] * A named typle assigning a log [`LogVerbosity`] to a [`LogMessageType`].
*/ */
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub struct LogMessage(LogMessageType, LogVerbosity); pub struct LogMessage(LogMessageType, LogVerbosity);