-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathlogfunctions.cc
88 lines (67 loc) · 1.83 KB
/
logfunctions.cc
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// 3/25/19: rust cannot currently define extern C variadic functions so were
// stuck with this shit
//
// TODO when rust supports extern variadic functions, replace all of this
// with var args versions
//
// 4/18/19 so because were stuck with this shit right now we spend a lot of
// time inside vsnprintf, only to discard the formatted results. We'll hack
// around this by not doing shit on release builds.
#include <stdio.h>
#include <stdarg.h>
#include "bochs.h"
logfunctions::logfunctions(void) {}
logfunctions::~logfunctions(void) {}
void logfunctions::error(const char *fmt, ...) {
#ifndef RUST_CC_RELEASE
char buf[0x1000];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof buf, fmt, args);
va_end(args);
printf("[ERROR] %s\n", buf);
#endif
}
void logfunctions::fatal1(const char *fmt, ...) {
#ifndef RUST_CC_RELEASE
char buf[0x1000];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof buf, fmt, args);
va_end(args);
printf("[FATAL] %s\n", buf);
#endif
}
void logfunctions::info(const char *fmt, ...) {
#ifndef RUST_CC_RELEASE
// char buf[0x1000];
// va_list args;
// va_start(args, fmt);
// vsnprintf(buf, sizeof buf, fmt, args);
// va_end(args);
// printf("[INFO] %s\n", buf);
#endif
}
void logfunctions::ldebug(const char *fmt, ...) {
#ifndef RUST_CC_RELEASE
// char buf[0x1000];
// va_list args;
// va_start(args, fmt);
// vsnprintf(buf, sizeof buf, fmt, args);
// va_end(args);
// printf("[LDEBUG] %s\n", buf);
#endif
}
void logfunctions::panic(const char *fmt, ...) {
#ifndef RUST_CC_RELEASE
char buf[0x1000];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof buf, fmt, args);
va_end(args);
printf("[PANIC] %s\n", buf);
#endif
}
void logfunctions::put(const char *p, const char *q) {}
void logfunctions::put(const char *p) {}
BOCHSAPI class logfunctions *genlog = NULL;