From b7579dec5d2aee57576b41e57db265ff2b5c9b06 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Wed, 30 Jun 2004 19:07:39 +0000 Subject: [PATCH] add debug checking version of logging function. (Logical change 1.17) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@39 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/print.c | 21 +++++++++++++++++++++ exec/print.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/exec/print.c b/exec/print.c index 76866f4e..0b32fbf6 100644 --- a/exec/print.c +++ b/exec/print.c @@ -56,6 +56,27 @@ internal_log_printf (int level, char *string, ...) va_end(ap); } +void +internal_log_printf_checkdebug (int level, char *string, ...) +{ + va_list ap; + char newstring[1024]; + + va_start(ap, string); + +#ifdef DEBUG + sprintf (newstring, "L(%x): %s", level, string); + vfprintf(stderr, newstring, ap); +#else + if (level != LOG_LEVEL_DEBUG) { + sprintf (newstring, "L(%x): %s", level, string); + vfprintf(stderr, newstring, ap); + } +#endif + + va_end(ap); +} + extern char *getSaClmNodeAddressT (SaClmNodeAddressT *nodeAddress) { int i; static char node_address[300]; diff --git a/exec/print.h b/exec/print.h index 1ad30051..5666cc8d 100644 --- a/exec/print.h +++ b/exec/print.h @@ -45,6 +45,8 @@ extern void internal_log_printf (int level, char *string, ...); +extern void internal_log_printf_checkdebug (int level, char *string, ...); + /* * The optimizer will remove DEBUG logging messages in production builds */