Minor logging improvements.

cert
Rob Riggs 2018-10-28 21:27:27 -05:00
rodzic a9ef136d41
commit ca6fb5aa5f
2 zmienionych plików z 14 dodań i 5 usunięć

Wyświetl plik

@ -2,6 +2,8 @@
// All rights reserved.
#include <Log.h>
#include <cstdarg>
#include <cstdio>
void log_(int level, const char* fmt, ...)
{

Wyświetl plik

@ -20,12 +20,19 @@ extern "C" {
void log_(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#ifndef KISS_LOG_LEVEL
#define KISS_LOG_LEVEL 0
#endif
#ifdef KISS_LOGGING
#define DEBUG(...) log_(0, __VA_ARGS__)
#define INFO(...) log_(1, __VA_ARGS__)
#define WARN(...) log_(2, __VA_ARGS__)
#define ERROR(...) log_(3, __VA_ARGS__)
#define SEVERE(...) log_(4, __VA_ARGS__)
#define LOG(level, ...) if(level >= KISS_LOG_LEVEL) log_(level, __VA_ARGS__);
#define DEBUG(...) LOG(0, __VA_ARGS__)
#define INFO(...) LOG(1, __VA_ARGS__)
#define WARN(...) LOG(2, __VA_ARGS__)
#define ERROR(...) LOG(3, __VA_ARGS__)
#define SEVERE(...) LOG(4, __VA_ARGS__)
#else
#define DEBUG(...)
#define INFO(...)