ca3d7c155b2b43679a14d1794eacb3b7e105dd33
[distributedratelimiting.git] / drl / logging.c
1 /* See the DRL-LICENSE file for this file's software license. */
2 #include <stdio.h>
3
4 #include "logging.h"
5
6 FILE *logfile;
7 uint8_t system_loglevel;
8
9 inline void printlog(const uint8_t level, const char *format, ...) {
10     va_list args;
11
12     if (system_loglevel <= level) {
13         va_start(args, format);
14         vfprintf(logfile, format, args);
15         va_end(args);
16     }
17 }
18
19 void flushlog() {
20     fflush(logfile);
21 }
22
23 int loglevel() {
24     return system_loglevel;
25 }