-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cpp
71 lines (58 loc) · 1.34 KB
/
Logger.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
// Copyright 2006-12 HumaNature Studios Inc.
#include "LoggingPch.h"
namespace core {
Logger::Logger()
: showAbove(kInfo)
, hideBelow(kInfo)
{
}
Logger::~Logger()
{
}
const char* Logger::severityStrings[] =
{
"FORCE",
"TRACE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"FATAL",
};
void Logger::ignore(const char* category)
{
ignoreCategories.SubscribeTo(category);
}
bool Logger::shouldLog(Severity severity, const CompactStringRelease& category)
{
if(severity == kForce)
{
// force is always shown
return true;
}
if(ignoreCategories.IsSubscribedTo(category))
{
// is an ignored category
return false;
}
if(severity > showAbove)
{
return true;
}
if(severity < hideBelow)
{
return false;
}
return IsSubscribedTo(category);
}
void Logger::log(Severity severity, const char* category, const char* message, ...)
{
if(shouldLog(severity, category))
{
va_list vargs;
va_start(vargs, message);
logVargs(severity, category, message, vargs);
va_end(vargs);
}
}
} // namespace core