Added SECURE_LOG* macro
authorZbigniew Jasinski <z.jasinski@samsung.com>
Tue, 18 Jun 2013 08:52:16 +0000 (10:52 +0200)
committerZbigniew Jasinski <z.jasinski@samsung.com>
Tue, 18 Jun 2013 09:41:47 +0000 (11:41 +0200)
[Issue#]        SSDWSSP-323
[Bug/Feature]   Log messages refactoring
[Cause]         SECURE_LOG* macro added for log messages refactoring
[Solution]      Added SECURE_LOG* macro
[Verification]  Compile with LOG_DEBUG_ENABLED and run. No tests should fail

Change-Id: Id2926d7a880f83c890f597aead7adc73b9e0dc72

include/common.h

index 3a66e98..6c21d1f 100644 (file)
 #define C_LOGE(...) do { } while(0)
 #endif //DLOG_ERROR_ENABLED
 
+/* for SECURE_LOG* purpose */
+#undef _SECURE_
+#ifndef _SECURE_LOG
+#define _SECURE_ (0)
+#else
+#define _SECURE_ (1)
+#endif
+#undef LOG_
+#define LOG_(id, prio, tag, fmt, arg...) \
+    ( __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg))
+#undef SECURE_LOG_
+#define SECURE_LOG_(id, prio, tag, fmt, arg...) \
+    (_SECURE_ ? ( __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg)) : (0))
+
+#define SECURE_LOGD(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
+#define SECURE_LOGI(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
+#define SECURE_LOGW(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
+#define SECURE_LOGE(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
+/****************************/
+
 void freep(void *p);
 void closep(int *fd);
 void fclosep(FILE **f);