Files

file  klog.h
 Logging module.
 

Macros

#define KLOG_MAX_LINE   255
 
#define KLOG(level, logger, ...)   klog_write(level, logger, __VA_ARGS__)
 
#define KLOG_ERR(logger, ...)   KLOG(LOG_ERROR, logger, __VA_ARGS__)
 
#define KLOG_WARN(logger, ...)   KLOG(LOG_WARNING, logger, __VA_ARGS__)
 
#define KLOG_INFO(logger, ...)   KLOG(LOG_INFO, logger, __VA_ARGS__)
 
#define KLOG_DEBUG(logger, ...)   KLOG(LOG_DEBUG, logger, __VA_ARGS__)
 
#define KLOG_SUFFIX_LEN   4
 
#define KLOG_PATH_LEN   255
 
#define KLOG_MAX_PATH   (KLOG_PATH_LEN - KLOG_SUFFIX_LEN - 1)
 
#define KLOG_PART_SIZE_DEFAULT   (1024 * 512)
 
#define KLOG_MAX_PARTS_DEFAULT   4
 
#define klog_write(level, logger, ...)
 

Functions

int klog_init_file (char *file_path, uint8_t file_path_len, uint32_t part_size, uint8_t max_parts)
 
void klog_console (unsigned level, const char *logger, const char *format,...)
 
void klog_file (unsigned level, const char *logger, const char *format,...)
 
void klog_cleanup (void)
 

Variables

uint8_t klog_console_level
 
uint8_t klog_file_level
 
bool klog_file_logging
 

Macro Definition Documentation

#define KLOG (   level,
  logger,
  ... 
)    klog_write(level, logger, __VA_ARGS__)
#define KLOG_DEBUG (   logger,
  ... 
)    KLOG(LOG_DEBUG, logger, __VA_ARGS__)
#define KLOG_ERR (   logger,
  ... 
)    KLOG(LOG_ERROR, logger, __VA_ARGS__)
#define KLOG_INFO (   logger,
  ... 
)    KLOG(LOG_INFO, logger, __VA_ARGS__)
#define KLOG_MAX_LINE   255
#define KLOG_MAX_PARTS_DEFAULT   4
#define KLOG_MAX_PATH   (KLOG_PATH_LEN - KLOG_SUFFIX_LEN - 1)
#define KLOG_PART_SIZE_DEFAULT   (1024 * 512)
#define KLOG_PATH_LEN   255
#define KLOG_SUFFIX_LEN   4
#define KLOG_WARN (   logger,
  ... 
)    KLOG(LOG_WARNING, logger, __VA_ARGS__)
#define klog_write (   level,
  logger,
  ... 
)
Value:
do { \
if (level <= klog_console_level) { \
klog_console(level, logger, __VA_ARGS__); \
} \
if (level <= klog_file_level && klog_file_logging) { \
klog_file(level, logger, __VA_ARGS__); \
} \
} while (0)
void klog_console(unsigned level, const char *logger, const char *format,...)
bool klog_file_logging
void klog_file(unsigned level, const char *logger, const char *format,...)
uint8_t klog_file_level
uint8_t klog_console_level

Function Documentation

void klog_cleanup ( void  )
void klog_console ( unsigned  level,
const char *  logger,
const char *  format,
  ... 
)
void klog_file ( unsigned  level,
const char *  logger,
const char *  format,
  ... 
)
int klog_init_file ( char *  file_path,
uint8_t  file_path_len,
uint32_t  part_size,
uint8_t  max_parts 
)

Variable Documentation

uint8_t klog_console_level
uint8_t klog_file_level
bool klog_file_logging