]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Add a metadata parameter to virLog{, V}Message
authorMiloslav Trmač <mitr@redhat.com>
Wed, 17 Oct 2012 18:17:14 +0000 (20:17 +0200)
committerEric Blake <eblake@redhat.com>
Thu, 15 Nov 2012 02:08:31 +0000 (19:08 -0700)
commitc780e9b8822f0977ae7a7a3488273af45dca0ead
tree19abc9a832e1596bcd9b782123caff344ef9e78b
parenta4c19459aa8634c43b51e8138fb1d7eec4c17824
Add a metadata parameter to virLog{, V}Message

... and update all users.  No change in functionality, the parameter
will be used later.

The metadata representation is as minimal as possible, but requires
the caller to allocate an array on stack explicitly.

The alternative of using varargs in the virLogMessage() callers:
* Would not allow the caller to optionally omit some metadata elements,
  except by having two calls to virLogMessage.
* Would not be as type-safe (e.g. using int vs. size_t), and the compiler
  wouldn't be able to do type checking
* Depending on parameter order:
  a) virLogMessage(..., message format, message params...,
                   metadata..., NULL)
     can not be portably implemented (parse_printf_format() is a glibc
     function)
  b) virLogMessage(..., metadata..., NULL,
                   message format, message params...)
     would prevent usage of ATTRIBUTE_FMT_PRINTF and the associated
     compiler checking.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
src/util/logging.c
src/util/logging.h
src/util/viraudit.c
src/util/virterror.c