vcpe/srcs/libs/zlog_module/zlog_module.c

43 lines
1.2 KiB
C
Raw Normal View History

2023-02-06 07:10:02 +00:00
//
// Created by xajhuang on 2023/2/6.
//
#include "zlog_module.h"
typedef struct {
ZLOG_MOD_NAME logModule;
zlog_category_t *pCat;
char catName[MAX_ZLOG_MOD_LEN];
} ZLOG_MODULE, *PZLOG_MODULE;
static ZLOG_MODULE g_zlogModule[] = {
{ZLOG_MOD_MAIN, NULL, "MAIN" },
{ZLOG_MOD_TASK, NULL, "TASK" },
{ZLOG_MOD_INIT, NULL, "INIT" },
{ZLOG_MOD_MISC, NULL, "MISC" },
{ZLOG_MOD_CONFIG, NULL, "CONFIG"},
{ZLOG_MOD_NET, NULL, "NET" },
{ZLOG_MOD_CRYPTO, NULL, "CRYPTO"},
{ZLOG_MOD_MQ, NULL, "MQ" },
{ZLOG_MOD_PROTO, NULL, "PROTO" },
{ZLOG_MOD_HTTPD, NULL, "HTTPD" },
#ifdef USED_LWIP
{ZLOG_MOD_USER, NULL, "USER" },
{ZLOG_MOD_PPPOE, NULL, "PPPOE" },
{ZLOG_MOD_VXLAN, NULL, "VXLAN" },
{ZLOG_MOD_LWIP, NULL, "LWIP" },
#endif
{ZLOG_MOD_OPENDHCPD, NULL, "DHCPD" }
};
zlog_category_t *zlog_get_mod_cat(ZLOG_MOD_NAME logMod) {
if (logMod >= ZLOG_MOD_MAX) {
return NULL;
}
if (g_zlogModule[logMod].pCat == NULL) {
g_zlogModule[logMod].pCat = zlog_get_category(g_zlogModule[logMod].catName);
}
return g_zlogModule[logMod].pCat;
}