kpatch/kpatch-build/log.h
Jessica Yu 3d6ea904e8 log: include error.h
Usage of error() requires error.h
2017-01-23 12:42:35 -08:00

27 lines
607 B
C

#ifndef _LOG_H_
#define _LOG_H_
#include <error.h>
/* Files that include log.h must define loglevel and childobj */
extern enum loglevel loglevel;
extern char *childobj;
#define ERROR(format, ...) \
error(1, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define log_debug(format, ...) log(DEBUG, format, ##__VA_ARGS__)
#define log_normal(format, ...) log(NORMAL, "%s: " format, childobj, ##__VA_ARGS__)
#define log(level, format, ...) \
({ \
if (loglevel <= (level)) \
printf(format, ##__VA_ARGS__); \
})
enum loglevel {
DEBUG,
NORMAL
};
#endif /* _LOG_H_ */