Changeset 2279
- Timestamp:
- 13/09/2008 16:11:35 (3 years ago)
- Location:
- box/trunk
- Files:
-
- 4 edited
-
infrastructure/buildenv-testmain-template.cpp (modified) (1 diff)
-
lib/common/Logging.cpp (modified) (3 diffs)
-
lib/common/Logging.h (modified) (5 diffs)
-
lib/server/Daemon.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/infrastructure/buildenv-testmain-template.cpp
r2166 r2279 258 258 case 't': 259 259 { 260 Console::SetTag(optarg); 260 Logging::SetProgramName(optarg); 261 Console::SetShowTag(true); 261 262 } 262 263 break; -
box/trunk/lib/common/Logging.cpp
r2231 r2279 36 36 Log::Level Logging::sGlobalLevel = Log::EVERYTHING; 37 37 Logging Logging::sGlobalLogging; //automatic initialisation 38 std::string Logging::sProgramName; 38 39 39 40 Logging::Logging() … … 207 208 void Logging::SetProgramName(const std::string& rProgramName) 208 209 { 210 sProgramName = rProgramName; 211 209 212 for (std::vector<Logger*>::iterator i = sLoggers.begin(); 210 213 i != sLoggers.end(); i++) … … 231 234 std::string Console::sTag; 232 235 233 void Console::SetTag(const std::string& rTag) 234 { 235 sTag = rTag; 236 sShowTag = true; 236 void Console::SetProgramName(const std::string& rProgramName) 237 { 238 sTag = rProgramName; 239 } 240 241 void Console::SetShowTag(bool enabled) 242 { 243 sShowTag = enabled; 237 244 } 238 245 -
box/trunk/lib/common/Logging.h
r2208 r2279 144 144 { 145 145 private: 146 static bool sShowTag; 146 147 static bool sShowTime; 147 148 static bool sShowTimeMicros; 148 static bool sShow Tag;149 static bool sShowPID; 149 150 static std::string sTag; 150 static bool sShowPID;151 151 152 152 public: … … 154 154 int line, std::string& rMessage); 155 155 virtual const char* GetType() { return "Console"; } 156 virtual void SetProgramName(const std::string& rProgramName) { }157 158 static void Set Tag(const std::string& rTag);156 virtual void SetProgramName(const std::string& rProgramName); 157 158 static void SetShowTag(bool enabled); 159 159 static void SetShowTime(bool enabled); 160 160 static void SetShowTimeMicros(bool enabled); … … 207 207 static Log::Level sGlobalLevel; 208 208 static Logging sGlobalLogging; 209 static std::string sProgramName; 209 210 210 211 public: … … 231 232 } 232 233 static void SetProgramName(const std::string& rProgramName); 234 static std::string GetProgramName() { return sProgramName; } 233 235 234 236 class Guard … … 248 250 } 249 251 }; 252 253 class Tagger 254 { 255 private: 256 std::string mOldTag; 257 258 public: 259 Tagger(const std::string& rTempTag) 260 { 261 mOldTag = Logging::GetProgramName(); 262 Logging::SetProgramName(mOldTag + " " + rTempTag); 263 } 264 ~Tagger() 265 { 266 Logging::SetProgramName(mOldTag); 267 } 268 }; 250 269 }; 251 270 -
box/trunk/lib/server/Daemon.cpp
r2252 r2279 236 236 case 't': 237 237 { 238 Console::SetTag(optarg); 238 Logging::SetProgramName(optarg); 239 Console::SetShowTag(true); 239 240 } 240 241 break;
Note: See TracChangeset
for help on using the changeset viewer.
