summaryrefslogtreecommitdiff
path: root/src/logging/logging.h
blob: 65895337715245cf30ab3dad5da8b8344c970679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef HONEY_LOGGING_H
#define HONEY_LOGGING_H

#include <stdio.h>

enum honey_log_level_t
   { FATAL, ERROR, WARN, INFO, DEBUG };

struct honey_log_info_t {
   enum honey_log_level_t log_level;
   FILE *log_file;
};

extern struct honey_log_info_t honey_log_info;

const char * honey_log_level_str();

void honey_log_set_level(enum honey_log_level_t level);
enum honey_log_level_t honey_log_get_level();

void honey_log_set_file(FILE *file);
FILE * honey_log_get_file();

void honey_log(enum honey_log_level_t required_level,
	       const char *prefix,
	       const char *fmt, ...);

#define honey_debug(...) honey_log(DEBUG, "[DEBUG] ", __VA_ARGS__)

#endif