-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreenReporter.h
More file actions
77 lines (51 loc) · 2.98 KB
/
Copy pathScreenReporter.h
File metadata and controls
77 lines (51 loc) · 2.98 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2006-12 HumaNature Studios Inc.
#ifndef __SCREENREPORTER_H__
#define __SCREENREPORTER_H__
// TODO - remove when script binding is in
#include "Input/IInputEventListener.h"
namespace core {
class ConsoleLuaScript;
class ScreenReporter
: public Logger
, public Singleton<ScreenReporter>
, public IInputEventListener
{
public:
ScreenReporter();
void Initialize();
void Finalize();
void bindFunctions(LuaContext* context);
virtual void logVargs(Severity severity, const CompactStringDebug& category, const char* message, va_list& vargs);
virtual void handleInputEvent(unsigned int eventType, void* eventData);
protected:
SubscriptionMap::iterator mCurrentCategory;
bool mEnabled;
int mLineIndex;
int mCategoryIndex;
virtual void addCategory(const CompactStringRelease& categoryName, bool initialValue);
void updateIndex();
void clear();
void writeLine(const char* text, int color);
void toggleEnabled();
void nextCategory(unsigned int callDepth = 0);
void previousCategory(unsigned int callDepth = 0);
friend class ScreenText;
friend class ConsoleLuaScript;
};
} // namespace core
#ifdef __HNS_LOGGING_ENABLED__
#define reportFatal(category, message, ...) core::ScreenReporter::Instance(core::Logger::kFatal, category, message, ## __VA_ARGS__)
#define reportError(category, message, ...) core::ScreenReporter::Instance(core::Logger::kError, category, message, ## __VA_ARGS__)
#define reportWarn(category, message, ...) core::ScreenReporter::Instance(core::Logger::kWarn , category, message, ## __VA_ARGS__)
#define reportInfo(category, message, ...) core::ScreenReporter::Instance(core::Logger::kInfo , category, message, ## __VA_ARGS__)
#define reportDebug(category, message, ...) core::ScreenReporter::Instance(core::Logger::kDebug, category, message, ## __VA_ARGS__)
#define reportTrace(category, message, ...) core::ScreenReporter::Instance(core::Logger::kTrace, category, message, ## __VA_ARGS__)
#else // __HNS_LOGGING_ENABLED__
#define reportFatal(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#define reportError(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#define reportWarn(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#define reportInfo(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#define reportDebug(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#define reportTrace(category, message, ...) DEAD_STRIP(category); DEAD_STRIP(message); DEAD_STRIP_PARAMS(__VA_ARGS__);
#endif // __HNS_LOGGING_ENABLED__
#endif // __SCREENREPORTER_H__