log: check log level
[platform/core/uifw/libtdm.git] / common / tdm_log.c
index 7cce09c..2f7152b 100644 (file)
 
 static unsigned int dlog_enable = 1;
 static unsigned int color_enable = 1;
-static unsigned int debug_level = TDM_LOG_LEVEL_INFO;
 
 static unsigned int need_check_env = 1;
 
 static unsigned int log_lock_init;
 static pthread_mutex_t log_lock;
 
+unsigned int tdm_log_debug_level = TDM_LOG_LEVEL_INFO;
+
 static void
 _tdm_log_check_env(void)
 {
@@ -78,11 +79,11 @@ _tdm_log_check_env(void)
 
        str = getenv("TDM_DEBUG_LEVEL");
        if (str)
-               debug_level = strtol(str, &end, 10);
+               tdm_log_debug_level = strtol(str, &end, 10);
 
        str = getenv("TDM_DEBUG");
        if (str && (strstr(str, "1")))
-               debug_level = TDM_LOG_LEVEL_DBG;
+               tdm_log_debug_level = TDM_LOG_LEVEL_DBG;
 
        str = getenv("TDM_DLOG");
        if (str && (strstr(str, "0")))
@@ -105,15 +106,15 @@ EXTERN void
 tdm_log_enable_debug(unsigned int enable)
 {
        if (enable)
-               debug_level = TDM_LOG_LEVEL_DBG;
+               tdm_log_debug_level = TDM_LOG_LEVEL_DBG;
        else
-               debug_level = TDM_LOG_LEVEL_INFO;
+               tdm_log_debug_level = TDM_LOG_LEVEL_INFO;
 }
 
 EXTERN void
 tdm_log_set_debug_level(int level)
 {
-       debug_level = level;
+       tdm_log_debug_level = level;
 }
 
 EXTERN void
@@ -132,7 +133,7 @@ tdm_log_print(int level, const char *fmt, ...)
                _tdm_log_check_env();
        }
 
-       if (level > debug_level)
+       if (level > tdm_log_debug_level)
                return;
 
        if (dlog_enable) {