core-legacy/include/logger.h

30 lines
1.1 KiB
C
Raw Permalink Normal View History

#ifndef EMGAUWA_LOGGER_H
#define EMGAUWA_LOGGER_H
2020-05-05 09:42:02 +00:00
#include <stdio.h>
#include <time.h>
2020-07-26 19:00:05 +00:00
#include <syslog.h>
2020-05-05 09:42:02 +00:00
#include <colors.h>
#include <config.h>
2020-05-05 20:29:04 +00:00
#define LOG_NONE INT_MAX
2020-11-13 01:06:48 +00:00
#ifndef __FILENAME__
#define __FILENAME__ __FILE__
#endif
2020-05-05 09:42:02 +00:00
void
2020-07-26 19:00:05 +00:00
logger_log(int level, const char *filename, int line, const char *func, const char *msg, ...);
2020-05-05 09:42:02 +00:00
2020-09-26 22:05:48 +00:00
#define LOGGER_NONE(...) logger_log(LOG_NONE , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_DEBUG(...) logger_log(LOG_DEBUG , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_INFO(...) logger_log(LOG_INFO , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_NOTICE(...) logger_log(LOG_NOTICE , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_WARNING(...) logger_log(LOG_WARNING, __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_ERR(...) logger_log(LOG_ERR , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_CRIT(...) logger_log(LOG_CRIT , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
#define LOGGER_EMERG(...) logger_log(LOG_EMERG , __FILENAME__, __LINE__, __func__, ##__VA_ARGS__)
2020-05-05 09:42:02 +00:00
#endif //EMGAUWA_LOGGER_H