diff --git a/src/util/virlog.c b/src/util/virlog.c index b8398d14f6..cfa44376f5 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -73,6 +73,10 @@ static regex_t *virLogRegex; VIR_LOG_DATE_REGEX " " VIR_LOG_TIME_REGEX ": " \ VIR_LOG_PID_REGEX ": " VIR_LOG_LEVEL_REGEX " : " +VIR_ENUM_DECL(virLogDestination); +VIR_ENUM_IMPL(virLogDestination, VIR_LOG_TO_OUTPUT_LAST, + "stderr", "syslog", "file", "journald"); + /* * Filters are used to refine the rules on what to keep or drop * based on a matching pattern (currently a substring) @@ -147,23 +151,6 @@ virLogUnlock(void) } -static const char * -virLogOutputString(virLogDestination ldest) -{ - switch (ldest) { - case VIR_LOG_TO_STDERR: - return "stderr"; - case VIR_LOG_TO_SYSLOG: - return "syslog"; - case VIR_LOG_TO_FILE: - return "file"; - case VIR_LOG_TO_JOURNALD: - return "journald"; - } - return "unknown"; -} - - static const char * virLogPriorityString(virLogPriority lvl) { @@ -1340,13 +1327,13 @@ virLogGetOutputs(void) case VIR_LOG_TO_FILE: virBufferAsprintf(&outputbuf, "%d:%s:%s", virLogOutputs[i].priority, - virLogOutputString(dest), + virLogDestinationTypeToString(dest), virLogOutputs[i].name); break; default: virBufferAsprintf(&outputbuf, "%d:%s", virLogOutputs[i].priority, - virLogOutputString(dest)); + virLogDestinationTypeToString(dest)); } } virLogUnlock(); diff --git a/src/util/virlog.h b/src/util/virlog.h index 443b3cdda8..b5056f541e 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -51,10 +51,11 @@ typedef enum { # define VIR_LOG_DEFAULT VIR_LOG_WARN typedef enum { - VIR_LOG_TO_STDERR = 1, + VIR_LOG_TO_STDERR = 0, VIR_LOG_TO_SYSLOG, VIR_LOG_TO_FILE, VIR_LOG_TO_JOURNALD, + VIR_LOG_TO_OUTPUT_LAST, } virLogDestination; typedef struct _virLogSource virLogSource;