CoffeePi
Coffee machine control for Raspberry Pi
Macros | Enumerations | Functions
logger.h File Reference

Go to the source code of this file.

Macros

#define USE_COLORS
 
#define KNRM   "\x1B[0m"
 
#define KRED   "\x1B[31m"
 
#define KGRN   "\x1B[32m"
 
#define KYEL   "\x1B[33m"
 
#define KBLU   "\x1B[34m"
 
#define KMAG   "\x1B[35m"
 
#define KCYN   "\x1B[36m"
 
#define KWHT   "\x1B[37m"
 
#define CLEARLINE   "\x1B[100D\x1B[1A\x1B[K"
 
#define KBOLD   "\x1B[1m"
 

Enumerations

enum  logger_type_t {
  LOG_INFO = 0, LOG_CAN = 1, LOG_OK = 2, LOG_WARN = 3,
  LOG_ERROR = 4, LOG_ERRORC = 5
}
 
enum  logger_verbose_t {
  V_NONE = 0, V_BASIC = 1, V_BREW = 2, V_HAL = 3,
  V_SQL = 4, V_STRIPE = 5, V_SPI = 6
}
 

Functions

void logger_error (const char *format,...)
 Outputs the printf like formatted message to stderr and colorizes it. More...
 
void logger_reset ()
 Resets the logger to prevent the previous line being overdrawn. More...
 
void logger (logger_verbose_t verboselevel, logger_type_t logtype, const char *format,...)
 prints the message to stdout and formats it More...
 
void logger (logger_verbose_t verboselevel, const char *format,...)
 prints the message to stdout More...
 

Macro Definition Documentation

#define CLEARLINE   "\x1B[100D\x1B[1A\x1B[K"
#define KBLU   "\x1B[34m"
#define KBOLD   "\x1B[1m"
#define KCYN   "\x1B[36m"
#define KGRN   "\x1B[32m"
#define KMAG   "\x1B[35m"
#define KNRM   "\x1B[0m"
#define KRED   "\x1B[31m"
#define KWHT   "\x1B[37m"
#define KYEL   "\x1B[33m"
#define USE_COLORS

Enumeration Type Documentation

Enumerator
LOG_INFO 
LOG_CAN 
LOG_OK 
LOG_WARN 
LOG_ERROR 
LOG_ERRORC 
Enumerator
V_NONE 
V_BASIC 
V_BREW 
V_HAL 
V_SQL 
V_STRIPE 
V_SPI 

Function Documentation

void logger ( logger_verbose_t  verboselevel,
logger_type_t  logtype,
const char *  format,
  ... 
)

prints the message to stdout and formats it

Parameters
verboselevelminimum verbose level for output
logtypetype of logmessage for coloring
formatprintf formatted string
void logger ( logger_verbose_t  verboselevel,
const char *  format,
  ... 
)

prints the message to stdout

Parameters
verboselevelminimum verbose level for output
formatprintf formatted string
void logger_error ( const char *  format,
  ... 
)

Outputs the printf like formatted message to stderr and colorizes it.

Parameters
formatprintf formatted string
void logger_reset ( )

Resets the logger to prevent the previous line being overdrawn.

Call after custom printf