kopia lustrzana https://github.com/mobilinkd/tnc3-firmware
Minor logging improvements.
rodzic
a9ef136d41
commit
ca6fb5aa5f
|
@ -2,6 +2,8 @@
|
|||
// All rights reserved.
|
||||
|
||||
#include <Log.h>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
|
||||
void log_(int level, const char* fmt, ...)
|
||||
{
|
||||
|
|
17
TNC/Log.h
17
TNC/Log.h
|
@ -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(...)
|
||||
|
|
Ładowanie…
Reference in New Issue