[Common] Disabled debug logs in common module.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 23 Nov 2015 09:16:29 +0000 (10:16 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Tue, 24 Nov 2015 10:56:17 +0000 (11:56 +0100)
[Verification] Code compiles, logic was not affected.

Change-Id: I3a453dd290daa27dcafe64f06db4b010273c663c
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/common/common.gyp
src/common/logger.h
src/content/content_instance.cc

index 43567a3b48cf463ff6bcc18937fe8143f7553ae5..0985f9efa2f235fa393e2c1bccc0f0fd4d492104 100644 (file)
@@ -2,6 +2,9 @@
   'includes':[
     '../common/common.gypi',
   ],
+  'variables': {
+    'enable_common_debug_logs%': '0',
+  },
   'targets': [
     {
       'target_name': 'tizen_common',
             }],
           ],
         }],
+        ['extension_build_type == "Debug"', {
+          'conditions': [
+            ['enable_common_debug_logs == 0', {
+              # remove TIZEN_DEBUG_ENABLE flag
+              'defines!': ['TIZEN_DEBUG_ENABLE'],
+            }],
+          ],
+        }],
       ],
       'direct_dependent_settings': {
         'libraries' : [
index 52407247a941b95e02eb7debc6f1391b9d94bf42..c30fc9096e9049c043ceab4b45b36b970b45fdf1 100644 (file)
@@ -6,6 +6,37 @@
 #define COMMON_LOGGER_H_
 
 #include <dlog.h>
+
+// Tizen 3.0 uses different debug flag (DLOG_DEBUG_ENABLE) which is always
+// enabled, following code allows to disable logs with DLOG_DEBUG priority if
+// TIZEN_DEBUG_ENABLE is not set.
+// This code should be removed when DLOG_DEBUG_ENABLE flag is no longer set
+// by default in dlog.h file.
+#undef LOG_
+#ifdef TIZEN_DEBUG_ENABLE
+#define LOG_(id, prio, tag, fmt, arg...) \
+  ({ do { \
+    __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+  } while (0); })
+#else  // TIZEN_DEBUG_ENABLE
+#define LOG_(id, prio, tag, fmt, arg...) \
+  ({ do { \
+    if ((int)prio != DLOG_DEBUG) { \
+      __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+    } \
+  } while (0); })
+#endif  // TIZEN_DEBUG_ENABLE
+
+#undef SECURE_LOG_
+#ifdef TIZEN_DEBUG_ENABLE
+#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
+  ({ do { \
+    __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
+  } while (0); })
+#else  // TIZEN_DEBUG_ENABLE
+#define SECURE_LOG_(id, prio, tag, fmt, arg...) NOP(fmt, ##arg)
+#endif  // TIZEN_DEBUG_ENABLE
+
 #include <string>
 #include <cstring>
 #include <sstream>
index bb2a3608b5b194ecba826b389676ea07e8fda47c..03c4b1848b67231881f4cbe4d78f8895652c617a 100755 (executable)
@@ -18,7 +18,6 @@
 
 #include <functional>
 #include <string>
-#include <dlog.h>
 #include <glib.h>
 #include <memory>
 #include <media_content.h>