-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloghelper.cpp
More file actions
33 lines (30 loc) · 732 Bytes
/
Copy pathloghelper.cpp
File metadata and controls
33 lines (30 loc) · 732 Bytes
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
#include "loghelper.h"
#include <stdio.h>
#include <stdarg.h>
void LogHelper::log(LogType type, const char * format, ...) {
#ifdef LOG_TRACE
if(type <= Trace)
#elif defined LOG_DEBUG
if(type <= Debug)
#elif defined LOG_INFO
if(type <= Info)
#elif defined LOG_WARN
if(type <= Warn)
#endif
{
va_list args;
if (type == Error) {
fprintf(stderr, "\033[40;31m");
}
else if (type == Warn) {
fprintf(stderr, "\033[40;33m");
}
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
if (type == Error || type == Warn) {
fprintf(stderr, "\033[0m");
}
fprintf(stderr, "\n");
}
}