mFrame
載入中...
搜尋中...
無符合項目
SinkLogger.h
1
7#ifndef MFRAME_83C3FBDB_A73F_4B50_8CBD_AB130B80F65C
8#define MFRAME_83C3FBDB_A73F_4B50_8CBD_AB130B80F65C
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15#include "./../io/PrintStream.h"
16#include "./../lang/Object.h"
17
18//----------------------------------------------------------------------------------------
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::util {
24 class SinkLogger;
25 class Logger;
26} // namespace ufm::util
27
28/* ***************************************************************************************
29 * Class/Interface/Struct/Enum
30 */
31
90 /* *************************************************************************************
91 * Class/Interface/Struct/Enum
92 */
93 public:
94 enum struct Level : uint8;
95
96 /* *************************************************************************************
97 * Variable
98 */
99 private:
101 ufm::io::PrintStream& vPrintStream;
103 uint64 vTimeStamp;
105 Level vLevel;
106
107 /* *************************************************************************************
108 * Abstract Method
109 */
110
111 /* *************************************************************************************
112 * Construct Method
113 */
114 public:
121
126 virtual ~SinkLogger(void) override;
127
128 /* *************************************************************************************
129 * Operator Method
130 */
131 public:
138 inline operator ufm::io::PrintStream&() {
139 return this->vPrintStream;
140 }
141
142 /* *************************************************************************************
143 * Override -
144 */
145
146 /* *************************************************************************************
147 * Public Method
148 */
149 public:
159 const char* vName = "",
160 const char* message = "");
161
168 inline SinkLogger& setLevel(Level level) {
169 this->vLevel = level;
170 return *this;
171 }
172
178 inline Level getLevel(void) const {
179 return this->vLevel;
180 }
181
191 return this->vPrintStream;
192 }
193
202 inline uint64 getTimeStamp(void) const {
203 return this->vTimeStamp;
204 }
205
206 /* *************************************************************************************
207 * Protected Method
208 */
209
210 /* *************************************************************************************
211 * Private Method
212 */
213
214 /* *************************************************************************************
215 * Static Variable
216 */
217
218 /* *************************************************************************************
219 * Static Method
220 */
221};
222
239enum struct ufm::util::SinkLogger::Level : uint8 {
240 SEVERE = 1,
241 WARNING = 2,
242 INFO = 3,
243 CONFIG = 4,
244 FINE = 5,
245 FINER = 6,
246 FINEST = 7
247};
248
249/* ***************************************************************************************
250 * End of file
251 */
252
253#endif /* MFRAME_83C3FBDB_A73F_4B50_8CBD_AB130B80F65C */
格式化輸出串流
Definition PrintStream.h:44
物件基底類別
Definition Object.h:63
日誌接收器類別,負責實際的日誌輸出處理。
Definition SinkLogger.h:89
ufm::io::PrintStream & printStream(void)
取得原始的 PrintStream 物件參考,不受日誌級別過濾影響。
Definition SinkLogger.h:190
Level
日誌級別列舉,定義日誌訊息的重要性層級。
Definition SinkLogger.h:239
Level getLevel(void) const
取得目前設定的日誌輸出級別。
Definition SinkLogger.h:178
virtual ~SinkLogger(void) override
解構 SinkLogger 物件,清理相關資源。
ufm::io::PrintStream & log(Level level, const char *vName="", const char *message="")
記錄一條指定級別的日誌訊息,包含來源名稱和訊息內容。
uint64 getTimeStamp(void) const
取得當前時間戳,精確到毫秒。
Definition SinkLogger.h:202
SinkLogger & setLevel(Level level)
設定日誌輸出的最低級別,低於此級別的訊息將被忽略。
Definition SinkLogger.h:168
SinkLogger(ufm::io::PrintStream &printStream)
建構 SinkLogger 物件,關聯到指定的輸出流。
Definition Iterable.h:28