Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_CLogger.h File Reference
#include <drivers/cs_Serial.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for cs_CLogger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _clog(level, addNewLine, fmt, ...)
 Logger class for C code. More...
 
#define CLOGvv(fmt, ...)   _clog(SERIAL_VERY_VERBOSE, true, fmt, ##__VA_ARGS__)
 
#define CLOGv(fmt, ...)   _clog(SERIAL_VERBOSE, true, fmt, ##__VA_ARGS__)
 
#define CLOGd(fmt, ...)   _clog(SERIAL_DEBUG, true, fmt, ##__VA_ARGS__)
 
#define CLOGi(fmt, ...)   _clog(SERIAL_INFO, true, fmt, ##__VA_ARGS__)
 
#define CLOGw(fmt, ...)   _clog(SERIAL_WARN, true, fmt, ##__VA_ARGS__)
 
#define CLOGe(fmt, ...)   _clog(SERIAL_ERROR, true, fmt, ##__VA_ARGS__)
 
#define CLOGf(fmt, ...)   _clog(SERIAL_FATAL, true, fmt, ##__VA_ARGS__)
 

Functions

void cs_clog (bool addNewLine, const char *fmt,...)
 

Macro Definition Documentation

◆ _clog

#define _clog (   level,
  addNewLine,
  fmt,
  ... 
)
Value:
if (level <= SERIAL_VERBOSITY) { \
cs_clog(addNewLine, fmt, ##__VA_ARGS__); \
}
#define SERIAL_VERBOSITY
Definition: cs_SerialTypes.h:32

Logger class for C code.

Generally, you want to use: CLOGv, CLOGd, CLOGi, CLOGw, CLOGe, or CLOGf. These can be used like printf(), but without padding, flags, width, or other specifier.

The logs will always be written to UART in plain text.

Since the log functions have an unknown amount of arguments, these macros require a variadic macro as well. See http://www.wikiwand.com/en/Variadic_macro. The two ## are e.g. a gcc specific extension that removes the , so that the ... arguments can also be left out.

◆ CLOGd

#define CLOGd (   fmt,
  ... 
)    _clog(SERIAL_DEBUG, true, fmt, ##__VA_ARGS__)

◆ CLOGe

#define CLOGe (   fmt,
  ... 
)    _clog(SERIAL_ERROR, true, fmt, ##__VA_ARGS__)

◆ CLOGf

#define CLOGf (   fmt,
  ... 
)    _clog(SERIAL_FATAL, true, fmt, ##__VA_ARGS__)

◆ CLOGi

#define CLOGi (   fmt,
  ... 
)    _clog(SERIAL_INFO, true, fmt, ##__VA_ARGS__)

◆ CLOGv

#define CLOGv (   fmt,
  ... 
)    _clog(SERIAL_VERBOSE, true, fmt, ##__VA_ARGS__)

◆ CLOGvv

#define CLOGvv (   fmt,
  ... 
)    _clog(SERIAL_VERY_VERBOSE, true, fmt, ##__VA_ARGS__)

◆ CLOGw

#define CLOGw (   fmt,
  ... 
)    _clog(SERIAL_WARN, true, fmt, ##__VA_ARGS__)

Function Documentation

◆ cs_clog()

void cs_clog ( bool  addNewLine,
const char *  fmt,
  ... 
)