Changeset 1225 for box/chris/merge/lib/common/Logging.h
- Timestamp:
- 16/12/2006 20:26:31 (5 years ago)
- File:
-
- 1 edited
-
box/chris/merge/lib/common/Logging.h (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/merge/lib/common/Logging.h
r1224 r1225 14 14 #include <vector> 15 15 16 /* 16 17 #define BOX_LOG(level, stuff) \ 17 18 { \ … … 21 22 Log::Write(level, __FILE__, __LINE__, line.str()); \ 22 23 } \ 24 } 25 */ 26 27 #define BOX_LOG(level, stuff) \ 28 { \ 29 std::ostringstream line; \ 30 line << stuff; \ 31 Logging::Log(level, __FILE__, __LINE__, line.str()); \ 23 32 } 24 33 … … 42 51 // Class 43 52 // Name: Logger 44 // Purpose: Abstract class (interface)for log targets53 // Purpose: Abstract base class for log targets 45 54 // Created: 2006/12/16 46 55 // … … 57 66 58 67 virtual bool Log(Log::Level level, const std::string& rFile, 59 const std::string& rLine, std::string& rMessage) = 0;68 int line, std::string& rMessage) = 0; 60 69 61 70 void Filter(Log::Level level) … … 75 84 // Name: Console 76 85 // Purpose: Console logging target 77 // Created: 2006/12/1 286 // Created: 2006/12/16 78 87 // 79 88 // -------------------------------------------------------------------------- … … 83 92 public: 84 93 virtual bool Log(Log::Level level, const std::string& rFile, 85 const std::string& rLine, std::string& rMessage);94 int line, std::string& rMessage); 86 95 virtual const char* GetType() { return "Console"; } 87 96 virtual void SetProgramName(const std::string& rProgramName) { } … … 93 102 // Name: Syslog 94 103 // Purpose: Syslog (or Windows Event Viewer) logging target 95 // Created: 2006/12/1 2104 // Created: 2006/12/16 96 105 // 97 106 // -------------------------------------------------------------------------- … … 104 113 105 114 virtual bool Log(Log::Level level, const std::string& rFile, 106 const std::string& rLine, std::string& rMessage);115 int line, std::string& rMessage); 107 116 virtual const char* GetType() { return "Syslog"; } 108 117 virtual void SetProgramName(const std::string& rProgramName); … … 112 121 // 113 122 // Class 114 // Name: Log 123 // Name: Logging 115 124 // Purpose: Static logging helper, keeps track of enabled loggers 116 125 // and distributes log messages to them. 117 // Created: 2006/12/1 2126 // Created: 2006/12/16 118 127 // 119 128 // -------------------------------------------------------------------------- 120 129 121 class Logg ers130 class Logging 122 131 { 123 132 private: … … 139 148 static void Remove (Logger* pOldLogger); 140 149 static void Log(Log::Level level, const std::string& rFile, 141 const std::string& rLine, const std::string& rMessage);150 int line, const std::string& rMessage); 142 151 static void SetContext(std::string context); 143 152 static void ClearContext();
Note: See TracChangeset
for help on using the changeset viewer.
