/
main.cpp
68 lines (61 loc) · 2.33 KB
/
main.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
/*
* The Doomsday Engine Project
*
* Copyright (c) 2012-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <de/TextApp>
#include <de/Log>
#include <de/LogFilter>
using namespace de;
int main(int argc, char **argv)
{
try
{
TextApp app(makeList(argc, argv));
app.initSubsystems(App::DisablePlugins | App::DisablePersistentData);
for (int j = 0; j < 2; ++j)
{
bool devMode = j > 0;
app.logFilter().setAllowDev(devMode);
for (int i = LogEntry::LowestLogLevel; i <= LogEntry::HighestLogLevel; ++i)
{
LogEntry::Level level = LogEntry::Level(i);
app.logFilter().setMinLevel(level);
LOG_AT_LEVEL(level, "Enabled level %s with dev:%b")
<< LogEntry::levelToText(level) << devMode;
for (int k = LogEntry::LowestLogLevel; k <= LogEntry::HighestLogLevel; ++k)
{
for (int d = 0; d < 2; ++d)
{
duint32 other = k | (d? LogEntry::Dev : 0);
LOG_AT_LEVEL(other,
"- (currently enabled %8s) entry at level %8s (context %3s): visible: %b")
<< LogEntry::levelToText(level)
<< LogEntry::levelToText(other)
<< LogEntry::contextToText(other)
<< LogBuffer::get().isEnabled(LogEntry::Generic | other);
}
}
}
}
}
catch (Error const &err)
{
warning(err.asText().c_str());
}
debug("Exiting main()...");
return 0;
}