#undef LOG_TAG
#define LOG_TAG "TBM"
+#if ENABLE_DLOG
+#include <dlog.h>
static unsigned int dlog_enable = 1;
+#else
+#include <stdarg.h>
+static unsigned int dlog_enable = 0;
+#endif
static unsigned int color_enable = 1;
static unsigned int assert_level = TBM_LOG_LEVEL_NONE;
void
tbm_log_enable_dlog(unsigned int enable)
{
- const char *str = getenv("TBM_DLOG");
- if (str)
- enable = (str[0] == '1') ? 1 : 0;
dlog_enable = enable;
}
void
-tbm_log_enable_debug(unsigned int enable)
-{
- if (enable)
- tbm_log_debug_level = TBM_LOG_LEVEL_DBG;
- else
- tbm_log_debug_level = TBM_LOG_LEVEL_INFO;
-}
-
-void
tbm_log_set_debug_level(int level)
{
tbm_log_debug_level = level;
va_end(arg);
}
+#if ENABLE_DLOG
static void
_tbm_log_dlog_print(int level, const char *fmt, va_list arg)
{
}
__dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmt, arg);
}
+#endif
void
tbm_log_print(int level, const char *fmt, ...)
if (level > tbm_log_debug_level)
return;
+#if ENABLE_DLOG
if (dlog_enable) {
va_start(arg, fmt);
_tbm_log_dlog_print(level, fmt, arg);
va_end(arg);
- } else {
+ }
+ else
+#endif
+ {
va_start(arg, fmt);
_tbm_log_vprint_stdout(level, fmt, arg);
va_end(arg);
assert(level > assert_level);
}
-void
-tbm_log_reset(void)
-{
- pthread_mutex_trylock(&log_lock);
- pthread_mutex_unlock(&log_lock);
-}