-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogMarker.cpp
More file actions
54 lines (41 loc) · 1.47 KB
/
LogMarker.cpp
File metadata and controls
54 lines (41 loc) · 1.47 KB
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
// Copyright 2006-13 HumaNature Studios Inc.
#include "PhyreCorePch.h"
namespace core {
LogMarker::LogMarker()
: enabled(true)
{
}
bool LogMarker::log(const char* file, int line, const char* function, Severity severity, const char* category, const char* message, ...)
{
if(message && enabled && ConsoleLogger::Instance().shouldLog(severity, category))
{
LargeStaticCharBuffer buffer;
buffer.clear();
va_list vargs;
va_start(vargs, message);
{
// append the message
PHYRE_VSNPRINTF(buffer.getCumulativeBuffer(), buffer.getRemainingBuffer(), message, vargs);
}
va_end(vargs);
if(severity <= kWarn
&& severity != kForce)
{
// show MSVC click link
PHYRE_SNPRINTF(buffer.getCumulativeBuffer(), buffer.getRemainingBuffer(), "\n %s(%d): %s", file, line, function);
}
Logger::ErrorBehavior errorBehavior = ConsoleLogger::Instance().log(severity, category, "%s", buffer.getBuffer());
switch(errorBehavior)
{
case ConsoleLogger::kBreak:
return true;
case ConsoleLogger::kIgnoreAll:
enabled = false;
break;
case ConsoleLogger::kContinue:
break;
}
}
return false;
}
} // namespace core