Revert "enhance debug log"
authorBoram Park <boram1288.park@samsung.com>
Mon, 30 Nov 2015 10:58:22 +0000 (19:58 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 30 Nov 2015 10:58:22 +0000 (19:58 +0900)
This reverts commit 6f49477b659e046d074b9ea51665a61b642aa187.

include/tdm_log.h
src/tdm.c

index d12129d..f0b999b 100644 (file)
@@ -55,7 +55,7 @@ extern int tdm_debug;
 #define LOG_TAG "TDM"
 
 #define TDM_DBG(fmt, args...) \
-       if (tdm_debug < 1) \
+    if (tdm_debug) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -65,7 +65,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_INFO(fmt, args...) \
-       if (tdm_debug < 2) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -75,7 +74,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_WRN(fmt, args...) \
-       if (tdm_debug < 3) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -85,7 +83,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_ERR(fmt, args...) \
-       if (tdm_debug < 4) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -100,7 +97,7 @@ extern int tdm_debug;
 #include <time.h>
 
 #define TDM_DBG(fmt, args...) \
-       if (tdm_debug < 1) \
+    if (tdm_debug) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -109,7 +106,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_INFO(fmt, args...) \
-       if (tdm_debug < 2) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -118,7 +114,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_WRN(fmt, args...) \
-       if (tdm_debug < 3) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
@@ -127,7 +122,6 @@ extern int tdm_debug;
        } while (0);
 
 #define TDM_ERR(fmt, args...) \
-       if (tdm_debug < 4) \
        do { \
                struct timespec ts;     \
                clock_gettime(CLOCK_MONOTONIC, &ts);    \
index 2a1ae1c..581b301 100644 (file)
--- a/src/tdm.c
+++ b/src/tdm.c
@@ -465,7 +465,7 @@ tdm_display_update(tdm_display *dpy)
 #define SUFFIX_MODULE    ".so"
 #define DEFAULT_MODULE   "libtdm-default"SUFFIX_MODULE
 
-int tdm_debug = 2;
+int tdm_debug;
 
 static tdm_private_display *g_private_display;
 static pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER;
@@ -693,12 +693,8 @@ tdm_display_init(tdm_error *error)
     }
 
     debug = getenv("TDM_DEBUG");
-    if (debug)
-    {
-        char buf[64];
-        snprintf (buf, sizeof buf, "%s", debug);
-        tdm_debug = atoi(buf);
-    }
+    if (debug && (strstr(debug, "1")))
+        tdm_debug = 1;
 
     private_display = calloc(1, sizeof(tdm_private_display));
     if (!private_display)