Log macros improved. 87/61987/2
authorRadoslaw Czerski <r.czerski@samsung.com>
Fri, 11 Mar 2016 16:42:13 +0000 (17:42 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Sat, 12 Mar 2016 11:07:48 +0000 (03:07 -0800)
Change-Id: I83be7a3345a00ee294a9bb14b9d998de43094a31
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
inc/log.h

index a2bec6e..95b7b44 100755 (executable)
--- a/inc/log.h
+++ b/inc/log.h
 
 #include <unistd.h>
 #include <dlog.h>
+#include <string.h>
 
 #undef LOG_TAG
 #define LOG_TAG "INDICATOR"
 
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
 #if !defined(_D)
-#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##arg)
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
 #endif
 
 #if !defined(_W)
-#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, fmt"\n", ##arg)
+#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
 #endif
 
 #if !defined(_E)
-#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##arg)
+#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
 #endif
 
 #define retvm_if(expr, val, fmt, arg...) do { \