only log messages if in debug mode
authorImran Zaman <imran.zaman@linux.intel.com>
Mon, 30 Jun 2014 11:53:00 +0000 (14:53 +0300)
committerImran Zaman <imran.zaman@linux.intel.com>
Mon, 30 Jun 2014 11:53:00 +0000 (14:53 +0300)
include/gsignond/gsignond-log.h
src/daemon/gsignond-daemon.c

index 65af19f..fcb65e0 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef __GSIGNOND_LOG_H_
 #define __GSIGNOND_LOG_H_
 
+#include "config.h"
+
 #include <glib.h>
 
 #include <execinfo.h>
 }
 
 /**
- * INFO:
+ * ERR:
  * @frmt: format string for the message
  * @...: arguments for the format string
  * 
- * Use this macro to log informational messages. GSignond will take care of
+ * Use this macro to log error messages. GSignond will take care of
  * correctly saving them.
  */
-#define INFO(frmt, args...) g_message("%f %s:%d %s " frmt , \
+#define ERR(frmt, args...)  g_critical("%f %s:%d %s " frmt , \
         g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
         __PRETTY_FUNCTION__, ##args)
 
 /**
- * ERR:
+ * WARN:
  * @frmt: format string for the message
  * @...: arguments for the format string
  * 
- * Use this macro to log error messages. GSignond will take care of
+ * Use this macro to log warning messages. GSignond will take care of
  * correctly saving them.
  */
-#define ERR(frmt, args...)  g_critical("%f %s:%d %s " frmt , \
+#define WARN(frmt, args...) g_warning("%f %s:%d %s " frmt , \
         g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
         __PRETTY_FUNCTION__, ##args)
 
+#ifdef ENABLE_DEBUG
 /**
- * WARN:
+ * INFO:
  * @frmt: format string for the message
  * @...: arguments for the format string
  * 
- * Use this macro to log warning messages. GSignond will take care of
+ * Use this macro to log informational messages. GSignond will take care of
  * correctly saving them.
  */
-#define WARN(frmt, args...) g_warning("%f %s:%d %s " frmt , \
+#define INFO(frmt, args...) g_message("%f %s:%d %s " frmt , \
         g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
         __PRETTY_FUNCTION__, ##args)
+
 /**
  * DBG:
  * @frmt: format string for the message
 #define DBG(frmt, args...)  g_debug("%f %s:%d %s " frmt , \
         g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
         __PRETTY_FUNCTION__, ##args)
+#else
+# define INFO(frmt, args...)
+# define DBG(frmt, args...)
+#endif
 
 #endif /* __GSIGNOND_LOG_H_ */
index 24b76d1..eb072c2 100644 (file)
@@ -156,14 +156,12 @@ _finalize (GObject *object)
 static gboolean
 _init_extension (GSignondDaemon *self)
 {
-    guint32 ext_ver = gsignond_extension_get_version (self->priv->extension);
-
     DBG ("Initializing extension '%s' %d.%d.%d.%d",
          gsignond_extension_get_name (self->priv->extension),
-         (ext_ver >> 24),
-         (ext_ver >> 16) & 0xff,
-         (ext_ver >> 8) & 0xff,
-         ext_ver & 0xff);
+         (gsignond_extension_get_version (self->priv->extension) >> 24),
+         (gsignond_extension_get_version (self->priv->extension) >> 16) & 0xff,
+         (gsignond_extension_get_version (self->priv->extension) >> 8) & 0xff,
+         gsignond_extension_get_version (self->priv->extension) & 0xff);
 
     self->priv->storage_manager =
         gsignond_extension_get_storage_manager (self->priv->extension,