void Log2File(const char* section, const char* key, const char* msg, va_list& ap, int nFileType = 0) { char szTmp[MAX_LOG_BUFF_SIZE]; memset(szTmp, 0, MAX_LOG_BUFF_SIZE * sizeof(char)); _Log(szTmp, section, key, msg, ap); if(g_logger.IsSetPath()) { if(g_logger_mutex == NULL) { g_logger.NewLine(nFileType) << szTmp << EndLine; } else { //dbmgr的多线程日志要加锁 CMutexGuard gm(*g_logger_mutex); g_logger.NewLine(nFileType) << szTmp << EndLine; } } else { printf("%s\n", szTmp); } }
void Log2Console(const char* section, const char* key, const char* msg, va_list& ap, int nFileType = 0) { char szTmp[MAX_LOG_BUFF_SIZE]; _Log(szTmp, section, key, msg, ap); #ifdef _DEBUG_VERSION_ printf("%s\n", szTmp); #else if(g_logger.IsSetPath()) { g_logger.NewLine(nFileType) << szTmp << EndLine; printf("%s\n", szTmp); } else { printf("%s\n", szTmp); } #endif }