]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: always include priority in log messages
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 3 Oct 2024 16:22:43 +0000 (17:22 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 17 Oct 2024 14:27:15 +0000 (09:27 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/173
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod.c

index e79fbf630afc7fa24b63a5f852e3c90b9921f70d..16b09de715e7722e0f633dd6cb3a4413696930e8 100644 (file)
@@ -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);
 }