]> xenbits.xensource.com Git - libvirt.git/commit
virlog: Introduce virLog{Get,Set}DefaultOutput
authorErik Skultety <eskultet@redhat.com>
Mon, 31 Oct 2016 11:50:24 +0000 (12:50 +0100)
committerErik Skultety <eskultet@redhat.com>
Thu, 15 Dec 2016 09:36:23 +0000 (10:36 +0100)
commitae06048bf5d84472320d1090bf36863c0219ccde
treeef45e69857221acf94b70aae56f91abdac15aebd
parent4b951d1e38259ff5d03e9eedb65095eead8099e1
virlog: Introduce virLog{Get,Set}DefaultOutput

These helpers will manage the log destination defaults (fetch/set). The reason
for this is to stay consistent with the current daemon's behaviour with respect
to /etc/libvirt/<daemon>.conf file, since both assignment of an empty string
or not setting the log output variable at all trigger the daemon's decision on
the default log destination which depends on whether the daemon runs daemonized
or not.
This patch also changes the logic of the selection of the default
logging output compared to how it is done now. The main difference though is
that we should only really care if we're running daemonized or not, disregarding
the fact of (not) having a TTY completely (introduced by commit eba36a3878) as
that should be of the libvirtd's parent concern (what FD it will pass to it).

 Before:
 if (godaemon || !hasTTY):
     if (journald):
         use journald

 if (godaemon):
     if (privileged):
         use SYSCONFIG/libvirtd.log
     else:
         use XDG_CONFIG_HOME/libvirtd.log
 else:
     use stderr

 After:
 if (godaemon):
     if (journald):
         use journald

     else:
         if (privileged):
             use SYSCONFIG/libvirtd.log
         else:
             use XDG_CONFIG_HOME/libvirtd.log
 else:
     use stderr

Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/libvirt_private.syms
src/util/virlog.c
src/util/virlog.h