IOC mediator: DEBUG: support IOC log file

This patch is used for IOC mediator debugging. Due to IOC message logs are
too much, need to save into one file instead of output stdout directly.
By default, the debug log is disabled.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Liu Yuan
2018-04-12 21:12:02 +08:00
committed by Jack Ren
parent 746d437642
commit 75b5e670d5
3 changed files with 36 additions and 11 deletions

View File

@@ -41,9 +41,11 @@
* Debug printf
*/
static int ioc_cbc_debug;
#define DPRINTF(fmt, args...) \
do { if (ioc_cbc_debug) printf(fmt, ##args); } while (0)
#define WPRINTF(fmt, args...) printf(fmt, ##args)
static FILE *dbg_file;
#define DPRINTF(format, arg...) \
do { if (ioc_cbc_debug && dbg_file) { fprintf(dbg_file, format, arg);\
fflush(dbg_file); } } while (0)
#define WPRINTF(format, arg...) printf(format, ##arg)
static void cbc_send_pkt(struct cbc_pkt *pkt);
@@ -895,3 +897,12 @@ wlist_init_signal(struct cbc_signal *cbc_tbl, size_t cbc_size,
}
}
}
/*
* Share log file with IOC.
*/
void
cbc_set_log_file(FILE *f)
{
dbg_file = f;
}