controller-legacy/include/logger.h

21 lines
913 B
C
Raw Normal View History

2020-02-08 12:50:54 +00:00
#ifndef CONTROLLER_LOGGER_H
#define CONTROLLER_LOGGER_H
2020-02-09 23:58:17 +00:00
#include <stdio.h>
2020-04-13 22:50:55 +00:00
#include <time.h>
2020-02-23 00:13:27 +00:00
2020-02-08 12:50:54 +00:00
#include <colors.h>
#include <config.h>
2020-04-24 13:08:26 +00:00
void
logger_log(FILE *stream, log_level_t level, const char *filename, int line, const char *func, const char *msg, ...);
2020-06-15 22:40:05 +00:00
#define LOG_TRACE(...) logger_log(stdout, LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#define LOG_DEBUG(...) logger_log(stdout, LOG_LEVEL_DEBUG, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#define LOG_INFO(...) logger_log(stdout, LOG_LEVEL_INFO , __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#define LOG_WARN(...) logger_log(stdout, LOG_LEVEL_WARN , __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#define LOG_ERROR(...) logger_log(stderr, LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#define LOG_FATAL(...) logger_log(stderr, LOG_LEVEL_FATAL, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
2020-02-08 12:50:54 +00:00
#endif //CONTROLLER_LOGGER_H