-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.h
More file actions
36 lines (30 loc) · 944 Bytes
/
Log.h
File metadata and controls
36 lines (30 loc) · 944 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
34
35
36
#pragma once
#include <stdio.h>
#include <stdarg.h>
#include <sys/syscall.h>
#include <unistd.h>
#define MVM_VERBOSE 1
#define MVM_DEBUG 2
#define MVM_INFO 3
#define MVM_WARN 4
#define MVM_ERROR 5
#define MVM_FATAL 6
inline void mvm_printf(int level, const char* file,
const char* func, int lineNum, const char* fmt, ...) {
if (fmt == NULL) {
return;
}
char buf[256 * 2];
va_list arg;
va_start(arg, fmt);
vsprintf(buf, fmt, arg);
va_end(arg);
printf("%s--%s:%d | %s\n", file, func, lineNum, buf);
}
#define ALOG(level, ...) mvm_printf(level, __FILE__, __FUNCTION__, (int)__LINE__, __VA_ARGS__);
#define ALOGV(...) ALOG(MVM_VERBOSE, __VA_ARGS__);
#define ALOGD(...) ALOG(MVM_DEBUG, __VA_ARGS__);
#define ALOGI(...) ALOG(MVM_INFO, __VA_ARGS__);
#define ALOGW(...) ALOG(MVM_WARN, __VA_ARGS__);
#define ALOGE(...) ALOG(MVM_ERROR, __VA_ARGS__);
#define ALOGF(...) ALOG(MVM_FATAL, __VA_ARGS__);