summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/internal.h8
-rw-r--r--src/node_device/node_device_udev.c2
-rw-r--r--src/util/logging.c35
-rw-r--r--src/util/logging.h41
-rw-r--r--src/util/viraudit.c4
-rw-r--r--src/util/virterror.c4
-rw-r--r--tests/testutils.c3
7 files changed, 55 insertions, 42 deletions
diff --git a/src/internal.h b/src/internal.h
index 8037a4ae84..3545404acd 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -349,15 +349,15 @@
# define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
# define PROBE(NAME, FMT, ...) \
- VIR_DEBUG_INT("trace." __FILE__ , __func__, __LINE__, \
+ VIR_DEBUG_INT("trace", __FILE__, __LINE__, __func__, \
#NAME ": " FMT, __VA_ARGS__); \
- if (LIBVIRT_ ## NAME ## _ENABLED()) { \
- PROBE_EXPAND(LIBVIRT_ ## NAME, \
+ if (LIBVIRT_ ## NAME ## _ENABLED()) { \
+ PROBE_EXPAND(LIBVIRT_ ## NAME, \
VIR_ADD_CASTS(__VA_ARGS__)); \
}
# else
# define PROBE(NAME, FMT, ...) \
- VIR_DEBUG_INT("trace." __FILE__, __func__, __LINE__, \
+ VIR_DEBUG_INT("trace", __FILE__, __LINE__, __func__, \
#NAME ": " FMT, __VA_ARGS__);
# endif
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index ba17010b99..2104bd3d62 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -358,7 +358,7 @@ static void udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
const char *fmt,
va_list args)
{
- VIR_ERROR_INT(file, fn, line, fmt, args);
+ VIR_ERROR_INT("library", file, line, fn, fmt, args);
}
diff --git a/src/util/logging.c b/src/util/logging.c
index 22472a0e88..a6ae669ffe 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -100,8 +100,9 @@ static int virLogResetFilters(void);
static int virLogResetOutputs(void);
static void virLogOutputToFd(const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
const char *timestamp,
unsigned int flags,
const char *rawstr,
@@ -651,8 +652,8 @@ cleanup:
static int
virLogFormatString(char **msg,
- const char *funcname,
int linenr,
+ const char *funcname,
virLogPriority priority,
const char *str)
{
@@ -696,7 +697,7 @@ virLogVersionString(const char **rawmsg,
#endif
*rawmsg = LOG_VERSION_STRING;
- return virLogFormatString(msg, NULL, 0, VIR_LOG_INFO, LOG_VERSION_STRING);
+ return virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, LOG_VERSION_STRING);
}
@@ -716,14 +717,17 @@ virLogVersionString(const char **rawmsg,
void
virLogMessage(const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
unsigned int flags,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- virLogVMessage(category, priority, funcname, linenr, flags, fmt, ap);
+ virLogVMessage(category, priority,
+ filename, linenr, funcname,
+ flags, fmt, ap);
va_end(ap);
}
@@ -744,8 +748,9 @@ virLogMessage(const char *category,
void
virLogVMessage(const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
unsigned int flags,
const char *fmt,
va_list vargs)
@@ -786,7 +791,7 @@ virLogVMessage(const char *category,
goto cleanup;
}
- ret = virLogFormatString(&msg, funcname, linenr, priority, str);
+ ret = virLogFormatString(&msg, linenr, funcname, priority, str);
if (ret < 0)
goto cleanup;
@@ -816,13 +821,14 @@ virLogVMessage(const char *category,
char *ver = NULL;
if (virLogVersionString(&rawver, &ver) >= 0)
virLogOutputs[i].f(category, VIR_LOG_INFO,
- __func__, __LINE__,
+ __FILE__, __LINE__, __func__,
timestamp, 0, rawver, ver,
virLogOutputs[i].data);
VIR_FREE(ver);
virLogOutputs[i].logVersion = false;
}
- virLogOutputs[i].f(category, priority, funcname, linenr,
+ virLogOutputs[i].f(category, priority,
+ filename, linenr, funcname,
timestamp, filterflags,
str, msg, virLogOutputs[i].data);
}
@@ -833,13 +839,14 @@ virLogVMessage(const char *category,
char *ver = NULL;
if (virLogVersionString(&rawver, &ver) >= 0)
virLogOutputToFd(category, VIR_LOG_INFO,
- __func__, __LINE__,
+ __FILE__, __LINE__, __func__,
timestamp, 0, rawver, ver,
(void *) STDERR_FILENO);
VIR_FREE(ver);
logVersionStderr = false;
}
- virLogOutputToFd(category, priority, funcname, linenr,
+ virLogOutputToFd(category, priority,
+ filename, linenr, funcname,
timestamp, filterflags,
str, msg, (void *) STDERR_FILENO);
}
@@ -875,8 +882,9 @@ virLogStackTraceToFd(int fd)
static void
virLogOutputToFd(const char *category ATTRIBUTE_UNUSED,
virLogPriority priority ATTRIBUTE_UNUSED,
- const char *funcname ATTRIBUTE_UNUSED,
+ const char *filename ATTRIBUTE_UNUSED,
int linenr ATTRIBUTE_UNUSED,
+ const char *funcname ATTRIBUTE_UNUSED,
const char *timestamp,
unsigned int flags,
const char *rawstr ATTRIBUTE_UNUSED,
@@ -960,8 +968,9 @@ virLogPrioritySyslog(virLogPriority priority)
static void
virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED,
virLogPriority priority,
- const char *funcname ATTRIBUTE_UNUSED,
+ const char *filename ATTRIBUTE_UNUSED,
int linenr ATTRIBUTE_UNUSED,
+ const char *funcname ATTRIBUTE_UNUSED,
const char *timestamp ATTRIBUTE_UNUSED,
unsigned int flags,
const char *rawstr ATTRIBUTE_UNUSED,
diff --git a/src/util/logging.h b/src/util/logging.h
index b376d0319d..421e4ab8b3 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -31,8 +31,8 @@
* defined at runtime from the libvirt daemon configuration file
*/
# ifdef ENABLE_DEBUG
-# define VIR_DEBUG_INT(category, f, l, ...) \
- virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
+# define VIR_DEBUG_INT(category, filename, linenr, funcname, ...) \
+ virLogMessage(category, VIR_LOG_DEBUG, filename, linenr, funcname, 0, __VA_ARGS__)
# else
/**
* virLogEatParams:
@@ -44,25 +44,25 @@ static inline void virLogEatParams(const char *unused, ...)
/* Silence gcc */
unused = unused;
}
-# define VIR_DEBUG_INT(category, f, l, ...) \
- virLogEatParams(category, f, l, __VA_ARGS__)
+# define VIR_DEBUG_INT(category, filename, linenr, funcname, ...) \
+ virLogEatParams(category, filename, linenr, funcname, __VA_ARGS__)
# endif /* !ENABLE_DEBUG */
-# define VIR_INFO_INT(category, f, l, ...) \
- virLogMessage(category, VIR_LOG_INFO, f, l, 0, __VA_ARGS__)
-# define VIR_WARN_INT(category, f, l, ...) \
- virLogMessage(category, VIR_LOG_WARN, f, l, 0, __VA_ARGS__)
-# define VIR_ERROR_INT(category, f, l, ...) \
- virLogMessage(category, VIR_LOG_ERROR, f, l, 0, __VA_ARGS__)
+# define VIR_INFO_INT(category, filename, linenr, funcname, ...) \
+ virLogMessage(category, VIR_LOG_INFO, filename, linenr, funcname, 0, __VA_ARGS__)
+# define VIR_WARN_INT(category, filename, linenr, funcname, ...) \
+ virLogMessage(category, VIR_LOG_WARN, filename, linenr, funcname, 0, __VA_ARGS__)
+# define VIR_ERROR_INT(category, filename, linenr, funcname, ...) \
+ virLogMessage(category, VIR_LOG_ERROR, filename, linenr, funcname, 0, __VA_ARGS__)
# define VIR_DEBUG(...) \
- VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
+ VIR_DEBUG_INT("file", __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_INFO(...) \
- VIR_INFO_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
+ VIR_INFO_INT("file", __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_WARN(...) \
- VIR_WARN_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
+ VIR_WARN_INT("file", __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_ERROR(...) \
- VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
+ VIR_ERROR_INT("file", __FILE__, __LINE__, __func__, __VA_ARGS__)
/*
* To be made public
@@ -98,8 +98,9 @@ typedef enum {
*/
typedef void (*virLogOutputFunc) (const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
const char *timestamp,
unsigned int flags,
const char *rawstr,
@@ -148,17 +149,19 @@ extern int virLogParseFilters(const char *filters);
extern int virLogParseOutputs(const char *output);
extern void virLogMessage(const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
unsigned int flags,
- const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(6, 7);
+ const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(7, 8);
extern void virLogVMessage(const char *category,
virLogPriority priority,
- const char *funcname,
+ const char *filename,
int linenr,
+ const char *funcname,
unsigned int flags,
const char *fmt,
- va_list vargs) ATTRIBUTE_FMT_PRINTF(6, 0);
+ va_list vargs) ATTRIBUTE_FMT_PRINTF(7, 0);
extern int virLogSetBufferSize(int size);
extern void virLogEmergencyDumpAll(int signum);
#endif
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 5941714f9f..ea1a79b0a2 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -103,10 +103,10 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
if (auditlog && str) {
if (success)
- virLogMessage("audit", VIR_LOG_INFO, func, linenr, 0,
+ virLogMessage("audit", VIR_LOG_INFO, file, linenr, func, 0,
"success=yes %s", str);
else
- virLogMessage("audit", VIR_LOG_WARN, func, linenr, 0,
+ virLogMessage("audit", VIR_LOG_WARN, file, linenr, func, 0,
"success=no %s", str);
}
diff --git a/src/util/virterror.c b/src/util/virterror.c
index b257e252e0..53f80afac7 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -676,8 +676,8 @@ virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED,
priority = virErrorLevelPriority(level);
if (virErrorLogPriorityFilter)
priority = virErrorLogPriorityFilter(to, priority);
- virLogMessage(filename, priority,
- funcname, linenr,
+ virLogMessage("error", priority,
+ filename, linenr, funcname,
virErrorLogPriorityFilter ? 0 : 1,
"%s", str);
diff --git a/tests/testutils.c b/tests/testutils.c
index eebe002c8e..56f34959b0 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -482,8 +482,9 @@ static struct virtTestLogData testLog = { VIR_BUFFER_INITIALIZER };
static void
virtTestLogOutput(const char *category ATTRIBUTE_UNUSED,
virLogPriority priority ATTRIBUTE_UNUSED,
+ const char *filename ATTRIBUTE_UNUSED,
+ int lineno ATTRIBUTE_UNUSED,
const char *funcname ATTRIBUTE_UNUSED,
- int linenr ATTRIBUTE_UNUSED,
const char *timestamp,
unsigned int flags,
const char *rawstr ATTRIBUTE_UNUSED,