C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
logger.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #define __LOG_ERROR__ 0
8 #define __LOG_WARN__ 1
9 #define __LOG_INFO__ 2
10 #define __LOG_DEBUG__ 3
11 #define __LOG_TRACE__ 4
12 
13 #define MAX_LOG_LEVELS 5
14 #define MAX_MODULES 4
15 #define COMMON_MODULE 1
16 
17 #define LOG_ERROR(mod,fmt, args...) app_log(mod, __LOG_ERROR__, NULL, fmt, ##args)
18 #define LOG_WARN(mod, fmt, args...) app_log(mod, __LOG_WARN__, NULL, fmt, ##args)
19 #define LOG_INFO(mod, fmt, args...) app_log(mod, __LOG_INFO__, NULL, fmt, ##args)
20 #define LOG_DEBUG(mod, fmt, args...) app_log(mod, __LOG_DEBUG__, NULL, fmt, ##args)
21 #define LOG_TRACE_IN(mod, fmt, args...) app_log(mod, __LOG_TRACE__, NULL, "[++%s:%4d]" fmt"\n", __func__, __LINE__, ##args)
22 #define LOG_TRACE_OUT(mod, fmt, args...) app_log(mod, __LOG_TRACE__, NULL, "[--%s:%4d]" fmt"\n", __func__, __LINE__, ##args)
23 
24 void logger_init();
25 int app_log(char *module, int level, char *prefix, const char *format, ...);
26 
int app_log(char *module, int level, char *prefix, const char *format,...)
Used for defining different logging modules such as warn, error, debug, trace ...
Definition: logger.c:33
void logger_init()
Initailize logger module
Definition: logger.c:17