SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
All Classes Files Functions Variables Typedefs Enumerations
Macros | Enumerations | Variables
linux/spsp/logger.hpp File Reference

Logger for SPSP. More...

#include <cstdint>
#include <cstdio>
Include dependency graph for linux/spsp/logger.hpp:

Go to the source code of this file.

Macros

#define _SPSP_LOG(level, levelLogStrPre, levelLogStrPost, fmt, ...)
 
#define SPSP_LOGD(fmt, ...)   _SPSP_LOG(DEBUG, "\033[0;34m[D]", "\033[0m", fmt, ##__VA_ARGS__)
 
#define SPSP_LOGI(fmt, ...)   _SPSP_LOG(INFO, "\033[0;36m[I]", "\033[0m", fmt, ##__VA_ARGS__)
 
#define SPSP_LOGW(fmt, ...)   _SPSP_LOG(WARN, "\033[0;33m[W]", "\033[0m", fmt, ##__VA_ARGS__)
 
#define SPSP_LOGE(fmt, ...)   _SPSP_LOG(ERROR, "\033[0;31m[E]", "\033[0m", fmt, ##__VA_ARGS__)
 

Enumerations

enum  LogLevel : uint_fast8_t {
  DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3,
  OFF = 255
}
 

Variables

LogLevel SPSP::logLevel
 Global log level.
 

Detailed Description

Logger for SPSP.

Author
Dávid Benko (david.nosp@m.benk.nosp@m.o@dav.nosp@m.idbe.nosp@m.nko.d.nosp@m.ev)

Definition in file linux/spsp/logger.hpp.

Macro Definition Documentation

◆ _SPSP_LOG

#define _SPSP_LOG (   level,
  levelLogStrPre,
  levelLogStrPost,
  fmt,
  ... 
)
Value:
do { \
if (SPSP::logLevel <= SPSP::LogLevel::level) { \
fprintf(stderr, levelLogStrPre " %s: " fmt "\n" levelLogStrPost, \
SPSP_LOG_TAG, ##__VA_ARGS__); \
} \
} while (0)

Definition at line 30 of file linux/spsp/logger.hpp.