Introduced Logging priority based loggin functions

which call the generic logging function
This commit is contained in:
Daniel Jawna
2024-10-28 18:19:55 +01:00
parent eb781c2902
commit 383eb6eb0d

View File

@@ -122,6 +122,42 @@ pub fn log(message: &str) {
}
}
/// Log function which takes as priority CRITICAL and category APPLICATION
#[doc(alias = "SDL_LogCritial")]
pub fn log_critical(message: &str) {
log_with_category(message, Category::Application, Priority::Critical);
}
/// Log function which takes as priority DEBUG and category APPLICATION
#[doc(alias = "SDL_LogDebug")]
pub fn log_debug(message: &str) {
log_with_category(message, Category::Application, Priority::Debug);
}
/// Log function which takes as priority ERROR and category APPLICATION
#[doc(alias = "SDL_LogError")]
pub fn log_error(message: &str) {
log_with_category(message, Category::Application, Priority::Error);
}
/// Log function which takes as priority INFO and category APPLICATION
#[doc(alias = "SDL_LogInfo")]
pub fn log_info(message: &str) {
log_with_category(message, Category::Application, Priority::Info);
}
/// Log function which takes as priority VERBOSE and category APPLICATION
#[doc(alias = "SDL_LogVerbose")]
pub fn log_verbose(message: &str) {
log_with_category(message, Category::Application, Priority::Verbose);
}
/// Log function which takes as priority WARN and category APPLICATION
#[doc(alias = "SDL_LogWarn")]
pub fn log_warn(message: &str) {
log_with_category(message, Category::Application, Priority::Warn);
}
/// Log function where Category and Priority can be specified
pub fn log_with_category(message: &str, category: Category, priority: Priority) {
let message = message.replace('%', "%%");