From: Michael Tremer Date: Fri, 25 Oct 2024 14:37:52 +0000 (+0000) Subject: logging: Remove the last bits of the Pakfire logger X-Git-Tag: 0.9.30~880 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80b0d24eb40ceccdea02374b9caca0b88d61d27a;p=pakfire.git logging: Remove the last bits of the Pakfire logger Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/logging.h b/src/libpakfire/include/pakfire/logging.h index ff25918d7..9beab0592 100644 --- a/src/libpakfire/include/pakfire/logging.h +++ b/src/libpakfire/include/pakfire/logging.h @@ -59,24 +59,5 @@ static inline void __attribute__((always_inline, format(printf, 2, 3))) # define CTX_DEBUG pakfire_ctx_log_null #endif -#define PAKFIRE_INFO(pakfire, arg...) pakfire_log_condition(pakfire, LOG_INFO, ## arg) -#define PAKFIRE_ERROR(pakfire, arg...) pakfire_log_condition(pakfire, LOG_ERR, ## arg) - -#define pakfire_log_condition(pakfire, level, arg...) \ - do { \ - if (pakfire_get_log_level(pakfire) >= level) \ - pakfire_log(pakfire, level, __FILE__, __LINE__, __FUNCTION__, ## arg); \ - } while (0) - -// This function does absolutely nothing -static inline void __attribute__((always_inline, format(printf, 2, 3))) - pakfire_log_null(struct pakfire* pakfire, const char *format, ...) {} - -#ifdef ENABLE_DEBUG -# define PAKFIRE_DEBUG(pakfire, arg...) pakfire_log_condition(pakfire, LOG_DEBUG, ## arg) -#else -# define PAKFIRE_DEBUG pakfire_log_null -#endif - #endif /* PAKFIRE_PRIVATE */ #endif /* PAKFIRE_LOGGING_H */ diff --git a/src/libpakfire/include/pakfire/pakfire.h b/src/libpakfire/include/pakfire/pakfire.h index 02bf2755e..ce44b64b9 100644 --- a/src/libpakfire/include/pakfire/pakfire.h +++ b/src/libpakfire/include/pakfire/pakfire.h @@ -112,13 +112,6 @@ gid_t pakfire_gid(struct pakfire* pakfire); const struct pakfire_subid* pakfire_subuid(struct pakfire* pakfire); const struct pakfire_subid* pakfire_subgid(struct pakfire* pakfire); -// Logging - -int pakfire_get_log_level(struct pakfire* pakfire); - -void pakfire_log(struct pakfire* pakfire, int level, const char* file, int line, - const char* fn, const char* format, ...) __attribute__((format(printf, 6, 7))); - struct pakfire_config* pakfire_get_config(struct pakfire* pakfire); int pakfire_confirm(struct pakfire* pakfire, const char* message, const char* question); diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 5116d5344..cf47b02c4 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -1523,29 +1523,6 @@ PAKFIRE_EXPORT int pakfire_search(struct pakfire* pakfire, const char* what, int SEARCH_SUBSTRING|SEARCH_NOCASE); } -// Logging - -int pakfire_get_log_level(struct pakfire* pakfire) { - return pakfire_ctx_get_log_level(pakfire->ctx); -} - -void pakfire_log(struct pakfire* pakfire, int priority, - const char* file, int line, const char* fn, const char* format, ...) { - char* buffer = NULL; - va_list args; - int r; - - va_start(args, format); - r = vasprintf(&buffer, format, args); - va_end(args); - - if (r < 0) - return; - - // Pass on to the context logger - pakfire_ctx_log(pakfire->ctx, priority, file, line, fn, "%s", buffer); -} - static const char* pakfire_user_lookup(void* data, la_int64_t uid) { struct pakfire* pakfire = (struct pakfire*)data;