PageRenderTime 15ms CodeModel.GetById 7ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/TGame/TUtil/Log/LogUtil.h

http://awoe.googlecode.com/
C++ Header | 61 lines | 41 code | 17 blank | 3 comment | 0 complexity | f43a112803fa4c0a77b67e78cd6fb330 MD5 | raw file
 1
 2#ifndef __LOG_UTILES___
 3#define __LOG_UTILES___
 4
 5#include <string>
 6
 7
 8namespace woe
 9{
10#ifdef UNICODE
11
12#define TS(str) L##str
13#else
14
15#define TS(str)	str
16#endif
17
18	enum
19	{
20		LGT_Simple,
21		LGT_ThreadSafe,
22		LGT_Async,
23	};
24
25
26	class TimeStamp 
27	{
28	public:
29        TimeStamp();
30        TimeStamp(unsigned int seconds, unsigned int microSeconds = 0);
31
32        inline int getSeconds() const {          return _seconds;        };
33
34        inline int getMilliSeconds() const {         return _microSeconds / 1000;        };
35
36        inline int getMicroSeconds() const {         return _microSeconds;        };
37
38		void format(std::string& fmt)const;
39
40        static inline const TimeStamp& getStartTime() {         return _startStamp;        };
41	protected:
42        static TimeStamp _startStamp;
43
44        int _seconds;
45        int _microSeconds;
46    };
47
48	class LogLevelUtil
49	{
50	public:
51		//
52		//	get log level name
53		//
54		static const std::string&		getLogLevelName(short lvl);
55		static short					getLogLevel(const std::string& lvlName);
56	protected:
57		static std::vector<std::string> __log_level_names;
58	};
59}
60
61#endif