1
0
mirror of https://github.com/falk-werner/webfused synced 2024-09-28 22:00:44 +00:00
falk-werner_webfused/src/webfused/log/log.h

69 lines
1.2 KiB
C
Raw Normal View History

2020-03-08 18:45:49 +00:00
#ifndef WFD_LOG_H
#define WFD_LOG_H
#ifndef __cplusplus
2020-03-18 16:33:31 +00:00
#include <stdbool.h>
2020-03-08 18:45:49 +00:00
#include <stdarg.h>
#else
#include <cstdarg>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef WFD_LOGLEVEL
#define WFD_LOGLEVEL WFD_LOGLEVEL_ALL
#endif
2020-03-18 16:33:31 +00:00
#define WFD_LOGLEVEL_NONE -1
2020-03-08 18:45:49 +00:00
#define WFD_LOGLEVEL_FATAL 1
#define WFD_LOGLEVEL_ERROR 3
#define WFD_LOGLEVEL_WARN 4
#define WFD_LOGLEVEL_INFO 5
#define WFD_LOGLEVEL_DEBUG 7
#define WFD_LOGLEVEL_ALL 8
#define WFD_FATAL(...) \
WFD_LOG(WFD_LOGLEVEL_FATAL, __VA_ARGS__)
#define WFD_ERROR(...) \
WFD_LOG(WFD_LOGLEVEL_ERROR, __VA_ARGS__)
#define WFD_WARN(...) \
WFD_LOG(WFD_LOGLEVEL_WARN, __VA_ARGS__)
#define WFD_INFO(...) \
WFD_LOG(WFD_LOGLEVEL_INFO, __VA_ARGS__)
#define WFD_DEBUG(...) \
WFD_LOG(WFD_LOGLEVEL_DEBUG, __VA_ARGS__)
#define WFD_LOG(level, ...) \
do { \
if (WFD_LOGLEVEL >= (level)) { \
wfd_log((level), __VA_ARGS__); \
} \
} while (0)
extern void
wfd_log(
int level,
char const * format,
...);
2020-03-18 16:33:31 +00:00
extern char const *
wfd_log_level_tostring(int level);
extern bool
wfd_log_level_parse(
char const * level,
int * result);
2020-03-08 18:45:49 +00:00
#ifdef __cplusplus
}
#endif
#endif