On Thu, Sep 20, 2012 at 08:24:06PM +0200, Miloslav Trmač wrote: > No change in functionality; the newly separated virLogPrioritySyslog > function will be used by the next patch. > > Signed-off-by: Miloslav Trmač <mitr@xxxxxxxxxx> > --- > src/util/logging.c | 36 +++++++++++++++++------------------- > 1 file changed, 17 insertions(+), 19 deletions(-) > > diff --git a/src/util/logging.c b/src/util/logging.c > index 5471552..b71eacc 100644 > --- a/src/util/logging.c > +++ b/src/util/logging.c > @@ -866,6 +866,22 @@ static int virLogAddOutputToFile(int priority, const char *file) { > } > > #if HAVE_SYSLOG_H > +static int virLogPrioritySyslog(virLogPriority priority) > +{ > + switch (priority) { > + case VIR_LOG_DEBUG: > + return LOG_DEBUG; > + case VIR_LOG_INFO: > + return LOG_INFO; > + case VIR_LOG_WARN: > + return LOG_WARNING; > + case VIR_LOG_ERROR: > + return LOG_ERR; > + default: > + return LOG_ERR; > + } > +} > + > static void virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED, > int priority, > const char *funcname ATTRIBUTE_UNUSED, > @@ -876,27 +892,9 @@ static void virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED, > const char *str, > void *data ATTRIBUTE_UNUSED) > { > - int prio; > - > virCheckFlags(VIR_LOG_STACK_TRACE,); > > - switch (priority) { > - case VIR_LOG_DEBUG: > - prio = LOG_DEBUG; > - break; > - case VIR_LOG_INFO: > - prio = LOG_INFO; > - break; > - case VIR_LOG_WARN: > - prio = LOG_WARNING; > - break; > - case VIR_LOG_ERROR: > - prio = LOG_ERR; > - break; > - default: > - prio = LOG_ERR; > - } > - syslog(prio, "%s", str); > + syslog(virLogPrioritySyslog(priority), "%s", str); > } ACK, useful refactoring independant of the rest of the code Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list