-
Notifications
You must be signed in to change notification settings - Fork 2
/
print.cpp
75 lines (58 loc) · 1.18 KB
/
print.cpp
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
#include "print.hpp"
namespace Horizon::Win32
{
const char* m_pPrintTypes[] =
{
"[*]",
"[warn]",
"[err]",
};
const wchar_t* m_pWidePrintTypes[] =
{
L"[*]",
L"[warn]",
L"[err]",
};
void DebugPrint( PrintType print_type, const char* message )
{
#ifdef DEBUG
char output[4096] = { };
auto type = m_pPrintTypes[static_cast<int>( print_type )];
sprintf_s( output, "%s %s\r\n", type, message );
printf( output );
#endif // DEBUG
}
void Trace( const char* format, ... )
{
#ifdef DEBUG
char message[2048] = { };
va_list args;
va_start( args, format );
int length = vsprintf_s( message, format, args );
va_end( args );
DebugPrint( PrintType::Trace, message );
#endif // DEBUG
}
void Warning( const char* format, ... )
{
#ifdef DEBUG
char message[2048] = { };
va_list args;
va_start( args, format );
int length = vsprintf_s( message, format, args );
va_end( args );
DebugPrint( PrintType::Warning, message );
#endif // DEBUG
}
void Error( const char* format, ... )
{
#ifdef DEBUG
char message[2048] = { };
va_list args;
va_start( args, format );
int length = vsprintf_s( message, format, args );
va_end( args );
DebugPrint( PrintType::Error, message );
#endif // DEBUG
}
}