dlog_enable = enable;
}
-EXTERN void
-tdm_log_enable_debug(unsigned int enable)
-{
- if (enable)
- tdm_log_debug_level = TDM_LOG_LEVEL_DBG;
- else
- tdm_log_debug_level = TDM_LOG_LEVEL_INFO;
-}
-
EXTERN void
tdm_log_set_debug_level(int level)
{
+ const char *str = getenv("TDM_DEBUG_LEVEL");
+ if (str)
+ level = str[0] - '0';
tdm_log_debug_level = level;
}
EXTERN void
tdm_log_set_assert_level(int level)
{
+ const char *str = getenv("TDM_ASSERT_LEVEL");
+ if (str)
+ level = str[0] - '0';
assert_level = level;
}
void tdm_log_enable_color(unsigned int enable);
void tdm_log_enable_dlog(unsigned int enable);
-void tdm_log_enable_debug(unsigned int enable);
void tdm_log_set_debug_level(int level);
void tdm_log_set_assert_level(int level);
void tdm_log_set_path(const char *path);
{
tdm_log_enable_color(1);
tdm_log_enable_dlog(0);
- tdm_log_enable_debug(1);
tdm_log_set_debug_level(2);
tdm_log_set_path("/tmp/tdm.log");
tdm_log_print(TDM_LOG_LEVEL_ERR, "utest\n");
{
tdm_log_enable_color(0);
tdm_log_enable_dlog(1);
- tdm_log_enable_debug(0);
tdm_log_set_debug_level(0);
tdm_log_print(TDM_LOG_LEVEL_ERR, "utest");
tdm_log_print(TDM_LOG_LEVEL_WRN, "utest");
TEST(TDMLog, logDlog)
{
tdm_log_enable_dlog(1);
- tdm_log_enable_debug(1);
tdm_log_print(TDM_LOG_LEVEL_ERR, "utest");
tdm_log_print(TDM_LOG_LEVEL_WRN, "utest");
tdm_log_print(TDM_LOG_LEVEL_INFO, "utest");
TEST(TDMLog, logDlogNormal)
{
tdm_log_enable_dlog(1);
- tdm_log_enable_debug(0);
tdm_log_print(TDM_LOG_LEVEL_ERR, "utest");
tdm_log_print(TDM_LOG_LEVEL_WRN, "utest");
tdm_log_print(TDM_LOG_LEVEL_INFO, "utest");