2010-08-08 10:06:34 +02:00
|
|
|
#ifndef H_UTIL_LOG
|
|
|
|
#define H_UTIL_LOG
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2013-12-29 09:19:22 +01:00
|
|
|
#include <stdio.h>
|
2016-01-31 21:39:28 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2016-02-05 23:10:05 +01:00
|
|
|
struct log_t;
|
|
|
|
|
|
|
|
typedef void(*log_fun)(void *data, int level, const char *module, const char *format, va_list args);
|
|
|
|
|
|
|
|
struct log_t * log_open(const char *filename, int flags);
|
|
|
|
struct log_t * log_create(int flags, void *data, log_fun call);
|
2016-05-01 13:47:30 +02:00
|
|
|
void log_destroy(struct log_t *handle);
|
2016-02-05 23:10:05 +01:00
|
|
|
struct log_t * log_to_file(int flags, FILE *out);
|
|
|
|
int log_level(struct log_t *log, int flags);
|
|
|
|
void log_close(void);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2018-05-03 22:40:54 +02:00
|
|
|
void log_fatal(const char *format, ...);
|
|
|
|
void log_error(const char *format, ...);
|
|
|
|
void log_warning(const char *format, ...);
|
|
|
|
void log_debug(const char *format, ...);
|
|
|
|
void log_info(const char *format, ...);
|
|
|
|
void log_printf(FILE * ios, const char *format, ...);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2018-05-03 22:40:54 +02:00
|
|
|
void errno_check(const char *file, int line);
|
2018-10-21 19:22:30 +02:00
|
|
|
|
|
|
|
int stats_count(const char *stat, int delta);
|
|
|
|
void stats_write(FILE *F, const char *prefix);
|
|
|
|
int stats_walk(const char *prefix, int (*callback)(const char *key, int val, void * udata), void *udata);
|
|
|
|
void stats_close(void);
|
|
|
|
|
2018-05-03 22:40:54 +02:00
|
|
|
#define ERRNO_CHECK() errno_check(__FILE__, __LINE__)
|
|
|
|
|
|
|
|
|
2016-01-31 19:54:49 +01:00
|
|
|
#define LOG_CPERROR 0x01
|
2010-08-08 10:06:34 +02:00
|
|
|
#define LOG_CPWARNING 0x02
|
2016-01-31 19:54:49 +01:00
|
|
|
#define LOG_CPINFO 0x04
|
|
|
|
#define LOG_CPDEBUG 0x08
|
|
|
|
#define LOG_LEVELS 0x0F
|
|
|
|
#define LOG_FLUSH 0x10
|
|
|
|
#define LOG_BRIEF 0x20
|
|
|
|
|
2016-05-20 20:55:27 +02:00
|
|
|
|
|
|
|
extern int log_stderr;
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|