#ifndef LOG_H #define LOG_H #include #include #define info(m,...) message (LOG_INFO, "info[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); #define warning(m,...) message (LOG_WARNING, "warning[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); #define error(m,...) message (LOG_ERR, "error[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); #define fatal(m,...) do { \ message (LOG_EMERG, "fatal[%s:%u]: " m, __func__, __LINE__, ##__VA_ARGS__); \ exit (EXIT_FAILURE); \ } while (0); void message (int level, char *const m, ...); #endif /* LOG_H */