New debug function cw_log_dbg for more granular debuging output.

FossilOrigin-Name: 9a8d171ec4ec12fa8f6050601236641b0bc7e54464304547b4fb35a0f0bdee69
This commit is contained in:
7u83@mail.ru 2014-08-14 08:04:07 +00:00
parent 2fe4d40f36
commit e2e5a5c612
1 changed files with 25 additions and 0 deletions

View File

@ -107,6 +107,31 @@ int cw_log_debug_dump_(int level,const uint8_t * data, int len,const char * form
int cw_log_debug_level=0;
static int dbg_opt_line_numbers=1;
static int dbg_opt_type=DBG_CAPWAP_MSG;
void cw_log_dbg_(int type, const char * file, int line, const char * format, ...)
{
if (!(type & dbg_opt_type))
return;
char buf[2048];
va_list args;
va_start(args, format);
vsprintf(buf,format,args);
va_end(args);
if (dbg_opt_line_numbers)
cw_log(LOG_DEBUG,"%s:%d: %s",file,line,buf);
else
cw_log(LOG_DEBUG,buf);
}
void (*cw_log_debug_cbs[])(const char * fromat, ...) = {
cw_log_debug0_,
cw_log_debug1_,