summaryrefslogtreecommitdiff
path: root/src/logging/logging.c
blob: 77c648cf20f749aa24ed5f30baf56f77cf46c759 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdarg.h>

#include "logging/logging.h"


struct honey_log_info_t honey_log_info;


const char * honey_log_level_str()
{
   switch(honey_log_info.log_level) {
   case DEBUG:
      return "DEBUG";
      break;

   case INFO:
      return "INFO";
      break;

   case WARN:
      return "WARN";
      break;

   case ERROR:
      return "ERROR";
      break;

   case FATAL:
      return "FATAL";
      break;

   default:
      return NULL;
      break;
   }
}


void honey_debug(const char *fmt, ...)
{
   if (honey_log_info.log_level >= DEBUG) {
      va_list args;
      va_start(args, fmt);
      fprintf(honey_log_info.debug_out, "[DEBUG] ");
      vfprintf(honey_log_info.debug_out, fmt, args);
      va_end(args);
   }
}