From: Emil Velikov Date: Thu, 3 Oct 2024 16:22:43 +0000 (+0100) Subject: libkmod: always include priority in log messages X-Git-Tag: v34~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5326afc9b91c4b58e018a95832183297fc850741;p=thirdparty%2Fkmod.git libkmod: always include priority in log messages One shouldn't need debug messages only to have the priority (emergency, error, warning ...) properly logged. With this the libkmod logger aligns with the custom one we use for kmod tools. The latter was printing the priority since day one. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/173 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index e79fbf63..16b09de7 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -85,7 +85,6 @@ _printf_format_(6, 0) static void log_filep(void *data, int priority, const char va_list args) { FILE *fp = data; -#ifdef ENABLE_DEBUG char buf[16]; const char *priname; switch (priority) { @@ -117,9 +116,10 @@ _printf_format_(6, 0) static void log_filep(void *data, int priority, const char snprintf(buf, sizeof(buf), "L:%d", priority); priname = buf; } +#ifdef ENABLE_DEBUG fprintf(fp, "libkmod: %s %s:%d %s: ", priname, file, line, fn); #else - fprintf(fp, "libkmod: %s: ", fn); + fprintf(fp, "libkmod: %s: %s: ", priname, fn); #endif vfprintf(fp, format, args); }