[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 5/9] Include filename explicitly in logging APIs



On 09/27/2012 10:44 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Currently the logging APIs have a 'const char *category' parameter
> which indicates where the log message comes from. This is typically
> a combination of the __FILE__ string and other prefix. Split the
> __FILE__ off into a dedicated parameter so it can passed to the
> log outputs
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  src/internal.h                     |  8 ++++----
>  src/node_device/node_device_udev.c |  2 +-
>  src/util/logging.c                 | 35 ++++++++++++++++++++------------
>  src/util/logging.h                 | 41 ++++++++++++++++++++------------------
>  src/util/viraudit.c                |  4 ++--
>  src/util/virterror.c               |  4 ++--
>  tests/testutils.c                  |  5 +++--
>  7 files changed, 56 insertions(+), 43 deletions(-)
> 
> diff --git a/src/internal.h b/src/internal.h
> index 8037a4a..a1d46b9 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__,    \

While you are touching this line, get rid of the space before comma.

> +++ b/tests/testutils.c
> @@ -481,9 +481,10 @@ static struct virtTestLogData testLog = { VIR_BUFFER_INITIALIZER };
>  
>  static void
>  virtTestLogOutput(const char *category ATTRIBUTE_UNUSED,
> -                  int priority ATTRIBUTE_UNUSED,
> +                  virLogPriority priority ATTRIBUTE_UNUSED,
> +                  const char *filename ATTRIBUTE_UNUSED,
> +                  size_t lineno ATTRIBUTE_UNUSED,
>                    const char *funcname ATTRIBUTE_UNUSED,
> -                  long long lineno ATTRIBUTE_UNUSED,
>                    const char *timestamp,

I see you already covered the test failures I reported in 1/9 and 2/9.

ACK with this squashed in:

diff --git i/src/internal.h w/src/internal.h
index 8037a4a..f8d9044 100644
--- i/src/internal.h
+++ w/src/internal.h
@@ -349,10 +349,10 @@

 #  define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
 #  define PROBE(NAME, FMT, ...)                              \
-    VIR_DEBUG_INT("trace." __FILE__ , __func__, __LINE__,    \
+    VIR_DEBUG_INT("trace." __FILE__, __func__, __LINE__,     \
                   #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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]