Various modules solving daily C developer tasks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

3 years ago
/******************************************************************************
*
* 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 */