📄 debg.c
字号:
/****************************************************************************** Copyright(C) 2005,2006 Frank ZHANG All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ****************************************************************************** If you want to distribute this software with modifications under any terms other than the GPL or distribute the software linked with proprietary applications that are not distributed in full compliance with the GNU Public License, a Commercial License is needed. Commercial licensing and support of this software are available at a fee. For more information, See http://www.openmgcp.org ******************************************************************************//******************************************************************************* Authors : Frank ZHANG* Description : Debug functions module*** Date of creation : 01/23/2006*** History :* 2006/01/23 Frank ZHANG : - Creation******************************************************************************/#include "debg.h"#include "stdio.h"#include "stdarg.h"#ifdef LOG_ONstatic int LogAbnfMsgOn; /* Flag to log the abnf messages */static int LogTaskMsgOn; /* Flag to log the inter-task messages */static int LogErrorOn; /* Flag to log the error messages *//****************************************************************************** * Function : LogMSG * * Description : Log the debug message * * Input parameters : iFlag - Which level debug info should be loged out. * format - Message log format, like the printf. * * Output parameters : * * Return value : NONE * * Comments : * * History : * 2006/01/23 : Creation * * Date : Jan 23 2006, Frank ZHANG ******************************************************************************/void LogMSG(int iFlag, char *format, ...){ va_list varArgs; va_start(varArgs, format); switch (iFlag) { case LOG_ABNF_MSG: if (LogAbnfMsgOn) vprintf(format, varArgs); break; case LOG_TASK_MSG: if (LogTaskMsgOn) vprintf(format, varArgs); break; case LOG_ERROR: if (LogErrorOn) vprintf(format, varArgs); break; default: Assert(0); break; } va_end(varArgs);}/****************************************************************************** * Function : Debug_On * * Description : Switch on the message debug * * Input parameters : iFlag - Which level debug info should be loged * * Output parameters : * * Return value : NONE * * Comments : * * History : * 2006/01/23 : Creation * * Date : Jan 23 2006, Frank ZHANG ******************************************************************************/void Debug_On(int iFlag){ switch (iFlag) { case LOG_ABNF_MSG: LogAbnfMsgOn = 1; break; case LOG_TASK_MSG: LogTaskMsgOn = 1; break; case LOG_ERROR: LogErrorOn = 1; break; default: Assert(0); break; }}/****************************************************************************** * Function : Debug_Off * * Description : Switch off the message debug * * Input parameters : iFlag - Which level debug info should stop log * * Output parameters : * * Return value : NONE * * Comments : * * History : * 2006/01/23 : Creation * * Date : Jan 23 2006, Frank ZHANG ******************************************************************************/void Debug_Off(int iFlag){ switch (iFlag) { case LOG_ABNF_MSG: LogAbnfMsgOn = 0; break; case LOG_TASK_MSG: LogTaskMsgOn = 0; break; case LOG_ERROR: LogErrorOn = 0; break; default: Assert(0); break; }}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -