aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
blob: 02d7271b27ac765805950d6adab5eac5e03412ce (plain) (blame)
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
#include "include/util.h"

void die(const char* fmt, ...) {
   va_list ap;

   fprintf(stderr, "[\e[31m==\e[0m] ERROR ");

   va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   va_end(ap);
   fprintf(stderr, "\n");

   exit(1);
}

void log_inf(const char* fmt, ...) {
   va_list ap;

   fprintf(stderr, "[\e[34m==\e[0m] ");

   va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   va_end(ap);

   fprintf(stderr, "\n");
}

void log_raw(const char* fmt, ...) {
   va_list ap;
   va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   va_end(ap);
}

void log_war(const char* fmt, ...) {
   va_list ap;

   fprintf(stderr, "[\e[33m==\e[0m] WARNING");

   va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   va_end(ap);

   fprintf(stderr, "\n");
}