38 #include <csp/csp_types.h> 48 #define KLOG_MAX_LINE 255 51 #define KLOG(handle, level, logger, ...) klog_write(handle, level, logger, __VA_ARGS__) 52 #define KLOG_ERR(handle, logger, ...) KLOG(handle, LOG_ERROR, logger, __VA_ARGS__) 53 #define KLOG_WARN(handle, logger, ...) KLOG(handle, LOG_WARNING, logger, __VA_ARGS__) 54 #define KLOG_TELEMETRY(handle, logger, ...) KLOG(handle, LOG_TELEMETRY, logger, __VA_ARGS__) 55 #define KLOG_INFO(handle, logger, ...) KLOG(handle, LOG_INFO, logger, __VA_ARGS__) 56 #define KLOG_DEBUG(handle, logger, ...) KLOG(handle, LOG_DEBUG, logger, __VA_ARGS__) 59 #define KLOG_SUFFIX_LEN 4 60 #define KLOG_PATH_LEN 255 61 #define KLOG_MAX_PATH (KLOG_PATH_LEN - KLOG_SUFFIX_LEN - 1) 63 #define KLOG_PART_SIZE_DEFAULT (1024 * 512) 64 #define KLOG_MAX_PARTS_DEFAULT 4 86 void klog_console(
unsigned level,
const char *logger,
const char *format, ...);
87 void klog_file(
klog_handle *handle,
unsigned level,
const char *logger,
const char *format, ...);
90 #define klog_write(handle, level, logger, ...) do { \ 91 if (level <= ((handle)->config.klog_console_level)) { \ 92 klog_console(level, logger, __VA_ARGS__); \ 94 if (level <= ((handle)->config.klog_file_level) && ((handle)->config.klog_file_logging)) { \ 95 klog_file(handle, level, logger, __VA_ARGS__); \
uint32_t part_size
Definition: klog.h:70
uint8_t max_parts
Definition: klog.h:71
char * file_path
Definition: klog.h:68
uint8_t klog_file_level
Definition: klog.h:73
FILE * log_file
Definition: klog.h:79
void klog_console(unsigned level, const char *logger, const char *format,...)
uint8_t klog_console_level
Definition: klog.h:72
uint8_t file_path_len
Definition: klog.h:69
void klog_cleanup(klog_handle *handle)
bool klog_file_logging
Definition: klog.h:74
klog_config config
Definition: klog.h:82
void klog_file(klog_handle *handle, unsigned level, const char *logger, const char *format,...)
uint32_t current_part_size
Definition: klog.h:81
int klog_init_file(klog_handle *handle)
uint8_t current_part
Definition: klog.h:80