#include "khatus_lib_log.h"
LogLevel _khatus_lib_log_level = Debug;
-
-void
-_fatal(char *fmt, ...) {
- va_list ap;
-
- va_start(ap, fmt);
- fprintf(stderr, fmt, ap);
- va_end(ap);
- exit(EXIT_FAILURE);
-}
#define info(...) if (_khatus_lib_log_level >= Info ) {fprintf(stderr, "[info] " __VA_ARGS__); fflush(stderr);}
#define warn(...) if (_khatus_lib_log_level >= Warn ) {fprintf(stderr, "[warn] " __VA_ARGS__); fflush(stderr);}
#define error(...) if (_khatus_lib_log_level >= Error) {fprintf(stderr, "[error] " __VA_ARGS__); fflush(stderr);}
-#define fatal(...) _fatal("[fatal] " __VA_ARGS__)
+#define fatal(...) {fprintf(stderr, "[fatal] " __VA_ARGS__); exit(EXIT_FAILURE);}
typedef enum LogLevel {
Nothing,
Debug
} LogLevel;
-void _fatal(char *, ...);
-
LogLevel _khatus_lib_log_level;