From 383eb6eb0d7b42126770b6eabc01e72998191a6f Mon Sep 17 00:00:00 2001 From: Daniel Jawna Date: Mon, 28 Oct 2024 18:19:55 +0100 Subject: [PATCH] Introduced Logging priority based loggin functions which call the generic logging function --- src/sdl2/log.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/sdl2/log.rs b/src/sdl2/log.rs index e9fd9e4e45..6bb07cf0fb 100644 --- a/src/sdl2/log.rs +++ b/src/sdl2/log.rs @@ -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('%', "%%");