cStuff/log.h

59 wiersze
1.3 KiB
C

/******************************************************************************
*
* Copyright (c) 2017-2019 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
* @file log.h
* @author Ilja Kartašov <ik@lowenware.com>
* @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 <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#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 * CStuffLog;
void
cstuff_log_init(CStuffLog self, int level);
void
cstuff_log_release(CStuffLog self);
CStuffRetcode
cstuff_log_set_file(CStuffLog self, const char *filename);
int
cstuff_log_printf(CStuffLog self, int level, const char *format, ...);
int
cstuff_log_vprintf(CStuffLog self, int level, const char *format, va_list vl);
#endif /* !CSTUFF_LOG_H */