diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-09-13 15:11:35 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-09-13 15:11:35 +0000 |
commit | b2a85e250ae595266fba001c9889fe8a3ee660e3 (patch) | |
tree | 21aac6f0a579676d12a30568986580732b57881a /lib/common/Logging.cpp | |
parent | 1ba40180e9740a151ddc1a23bb497ade403ec103 (diff) |
Unify program name and console logging tags.
Add a new class, Logging::Tagger, which can be used to temporarily
add information to the program name, such as the client ID in bbstored.
Diffstat (limited to 'lib/common/Logging.cpp')
-rw-r--r-- | lib/common/Logging.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index 3edb5ce6..df7c609e 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -35,6 +35,7 @@ Console* Logging::spConsole = NULL; Syslog* Logging::spSyslog = NULL; Log::Level Logging::sGlobalLevel = Log::EVERYTHING; Logging Logging::sGlobalLogging; //automatic initialisation +std::string Logging::sProgramName; Logging::Logging() { @@ -206,6 +207,8 @@ void Logging::ClearContext() void Logging::SetProgramName(const std::string& rProgramName) { + sProgramName = rProgramName; + for (std::vector<Logger*>::iterator i = sLoggers.begin(); i != sLoggers.end(); i++) { @@ -230,10 +233,14 @@ bool Console::sShowTag = false; bool Console::sShowPID = false; std::string Console::sTag; -void Console::SetTag(const std::string& rTag) +void Console::SetProgramName(const std::string& rProgramName) +{ + sTag = rProgramName; +} + +void Console::SetShowTag(bool enabled) { - sTag = rTag; - sShowTag = true; + sShowTag = enabled; } void Console::SetShowTime(bool enabled) |