/****************************************************************************** * * Copyright (c) 2017-2019 by Löwenware Ltd * Please, refer LICENSE file for legal information * ******************************************************************************/ /** * @file log.h * @author Ilja Kartašov * @brief cStuff log module header file * * @see https://lowenware.com/cStuff/ */ #ifndef CSTUFF_LOG_H_557ADEFE_2BE8_4B9B_A894_F08FF64008EF #define CSTUFF_LOG_H_557ADEFE_2BE8_4B9B_A894_F08FF64008EF #include #include #include #include "retcode.h" #define CSTUFF_LOG_OFF (0) #define CSTUFF_LOG_ERROR (1<<0) #define CSTUFF_LOG_ALERT (1<<1) #define CSTUFF_LOG_STATE (1<<2) #define CSTUFF_LOG_DEBUG (1<<3) #define CSTUFF_LOG_ALL (0xFF) struct cstuff_log { FILE * target; uint8_t level; }; typedef struct cstuff_log * cstuff_log_t; void cstuff_log_init(cstuff_log_t self, uint8_t level); void cstuff_log_release(cstuff_log_t self); cstuff_retcode_t cstuff_log_set_file(cstuff_log_t self, const char * filename); int cstuff_log_printf(cstuff_log_t self, uint8_t level, const char * format, ...); int cstuff_log_vprintf( cstuff_log_t self, uint8_t level, const char * format, va_list vl ); #endif /* !CSTUFF_LOG_H */