Compare commits

..

No commits in common. "dd5bfff7d2f0859e92ca1ca1b068638e3eb1333c" and "cbfa4cbfdf100d6246e32f0e979418e0eb2be9f3" have entirely different histories.

3 changed files with 7 additions and 19 deletions

View File

@ -1,14 +1,5 @@
/*!
* 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;

View File

@ -1,6 +1,6 @@
/*!
* This module handles logging messages asynchronously and is thread-safe.
* It should mostly be called statically using the [`log!`] macro.
* It should mostly be called statically.
*/
mod test;
@ -92,10 +92,7 @@ pub fn log_to_str(
}
/**
* 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.
* Shorthand version for [`log_message`], which does not require information about the [`config::Config::log_location`].
*/
#[macro_export]
macro_rules! log {
@ -112,7 +109,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)]
pub struct LogMessage(LogMessageType, LogVerbosity);

View File

@ -67,7 +67,7 @@ pub fn log_msg_file() {
create_dir_all(PathBuf::from(LOG_DIR.as_str()))
.unwrap_or_else(|_| panic!("Could not create directory: {}", *LOG_DIR));
log!(&message, &config);
log_message(&message, &config, file!(), line!(), column!());
let log_file = read_to_string(PathBuf::from(log_path))
.unwrap_or_else(|_| panic!("Could not read file: {log_path}"));
@ -91,7 +91,7 @@ pub fn log_str() {
.expect("There should be a log line.")
+ "\n";
log!(&message, &config);
log_message(&message, &config, file!(), line!(), column!());
let log_file = read_to_string(PathBuf::from(log_path))
.unwrap_or_else(|_| panic!("Could not read file: {log_path}"));
@ -122,7 +122,7 @@ pub fn verbosity_no_filter() {
+ "\n";
for msg in messages {
log!(&msg, &config);
log_message(&msg, &config, file!(), line!(), column!());
}
let log_file = read_to_string(PathBuf::from(log_path))
@ -156,7 +156,7 @@ pub fn verbosity_filter() {
+ "\n");
for msg in messages {
log!(&msg, &config);
log_message(&msg, &config, file!(), line!(), column!());
}
let log_file = read_to_string(PathBuf::from(log_path))