📄 sys_logger.h
字号:
#ifndef _INCLUDE_SYS_LOGGER_H_
#define _INCLUDE_SYS_LOGGER_H_
enum {
SYS_LOG_STDOUT = BIT(0), /* The log information is print on stdout */
SYS_LOG_LOG = BIT(1), /* The log information is print throught syslog */
SYS_LOG_FILE = BIT(2), /* The log information is print info the given log files */
SYS_LOG_NET = BIT(3), /* The log information is sent out through network */
};
/* debug bitmap deifnation */
enum {
DBG_IE = BIT(0),
DBG_IN = BIT(1),
DBG_IW = BIT(2),
DBG_CE = BIT(4),
DBG_CN = BIT(5),
DBG_CW = BIT(6),
DBG_TE = BIT(8),
DBG_TN = BIT(9),
DBG_TW = BIT(10),
DBG_L0 = BIT(16),
DBG_L1 = BIT(17),
DBG_L2 = BIT(18),
DBG_L3 = BIT(19),
DBG_L4 = BIT(20),
DBG_L5 = BIT(21),
DBG_L6 = BIT(22),
DBG_L7 = BIT(23),
};
/* trace bitmap deifnation */
enum {
TRC_IM = BIT(0), /* initialization trace main function */
TRC_IN = BIT(1), /* initialization trace minor function */
TRC_CM = BIT(2), /* system call trace main function */
TRC_CN = BIT(3), /* system call trace minor function */
TRC_TM = BIT(4), /* task main function */
TRC_TN = BIT(5), /* task minor function */
TRC_L0 = BIT(16),
TRC_L1 = BIT(17),
TRC_L2 = BIT(18),
TRC_L3 = BIT(19),
TRC_L4 = BIT(20),
TRC_L5 = BIT(21),
TRC_L6 = BIT(22),
TRC_L7 = BIT(23),
};
/*
* This data structure is used to send the parameter of the logs,
* when the log infomation want to be write into files or send through network.
*/
typedef struct sys_log_cfg_s {
char * pbyName; /* The name of the logger user, used to control it, majorname_minorname */
u32 uwModeUsed; /* all the log mechanism bitmap want to use */
u32 uwDbgAllSet;
u32 uwDbgAllClr;
u32 uwTrcAllSet;
u32 uwTrcAllClr;
/* The following information is used to control the stdout log */
u32 uwDbgStdout;
u32 uwTrcStdout;
/* The following information is used to control the syslog */
u32 uwDbgLogger;
u32 uwTrcLogger;
u32 uwLogPriBitmap;
/* The following information is used for file log */
u32 uwDbgFile;
u32 uwTrcFile;
char * pbyLogDir; /* The directory path containing the log file */
char * pbyPrefix; /* The file name prefix, the file name is : prefix_%d_suffix */
char * pbySuffix; /* The file name suffix, the file name is : prefix_%d_suffix */
u32 uwMaxLogFiles; /* how many log file could be used */
u32 uwMaxFileSize; /* the max size of one log file */
/* The following information is used for network log */
u32 uwDbgNet;
u32 uwTrcNet;
char * pbyIpAddr;
int * iPortNumber;
} sys_log_cfg_t;
#define SYS_TRC(hd,level,str) \
sys_logger_trc( hd, level, __FILE__, __FUNCTION__, __LINE__, str )
#define SYS_DBG( hd, level, format, args...) \
sys_logger_dbg( hd, level, __FILE__, __FUNCTION__, __LINE__, format, ## args )
/* externals */
extern u32 sys_logger_create( sys_log_cfg_t * pLogCfg );
extern void sys_logger_release( u32 uwHd );
extern void sys_logger_printf( u32 uwHd, char * pbyFormattedStr, ... );
void sys_logger_trc( u32 uwHd, u32 uwLevel, char * pbyFileName, char * pbyFuncName, int iLine, char * pbyFlag );
extern void sys_logger_dbg( u32 uwHd, u32 uwLevel, char * pbyFileName, char * pbyFuncName, int iLine, char * pFormattedStr, ... );
#endif /* _INCLUDE_SYS_LOGGER_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -