aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp b/src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp
new file mode 100644
index 0000000..5b3feec
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CLogger.cpp
@@ -0,0 +1,102 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#include "CLogger.h"
6
7namespace irr
8{
9
10 CLogger::CLogger(IEventReceiver* r)
11 : LogLevel(ELL_INFORMATION), Receiver(r)
12 {
13 #ifdef _DEBUG
14 setDebugName("CLogger");
15 #endif
16 }
17
18 //! Returns the current set log level.
19 ELOG_LEVEL CLogger::getLogLevel() const
20 {
21 return LogLevel;
22 }
23
24 //! Sets a new log level.
25 void CLogger::setLogLevel(ELOG_LEVEL ll)
26 {
27 LogLevel = ll;
28 }
29
30 //! Prints out a text into the log
31 void CLogger::log(const c8* text, ELOG_LEVEL ll)
32 {
33 if (ll < LogLevel)
34 return;
35
36 if (Receiver)
37 {
38 SEvent event;
39 event.EventType = EET_LOG_TEXT_EVENT;
40 event.LogEvent.Text = text;
41 event.LogEvent.Level = ll;
42 if (Receiver->OnEvent(event))
43 return;
44 }
45
46 os::Printer::print(text);
47 }
48
49
50 //! Prints out a text into the log
51 void CLogger::log(const c8* text, const c8* hint, ELOG_LEVEL ll)
52 {
53 if (ll < LogLevel)
54 return;
55
56 core::stringc s = text;
57 s += ": ";
58 s += hint;
59 log (s.c_str(), ll);
60 }
61
62 //! Prints out a text into the log
63 void CLogger::log(const wchar_t* text, ELOG_LEVEL ll)
64 {
65 if (ll < LogLevel)
66 return;
67
68 core::stringc s = text;
69 log(s.c_str(), ll);
70 }
71
72
73 //! Prints out a text into the log
74 void CLogger::log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll)
75 {
76 if (ll < LogLevel)
77 return;
78
79 core::stringc s1 = text;
80 core::stringc s2 = hint;
81 log(s1.c_str(), s2.c_str(), ll);
82 }
83
84 //! Prints out a text into the log
85 void CLogger::log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll)
86 {
87 if (ll < LogLevel)
88 return;
89
90 core::stringc s2 = hint;
91 log( text, s2.c_str(), ll);
92 }
93
94 //! Sets a new event receiver
95 void CLogger::setReceiver(IEventReceiver* r)
96 {
97 Receiver = r;
98 }
99
100
101} // end namespace irr
102