From 1a948d1c2b1eb2d8b868e81648fb19d359b71a8e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 22 Feb 2008 00:43:16 +0000 Subject: Disable -P option and showing PID in Logging on Windows. --- lib/common/Logging.cpp | 8 ++++++++ lib/common/Logging.h | 4 ++++ lib/server/Daemon.cpp | 8 +++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index 7da7409d..9b9721a8 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -182,7 +182,9 @@ Logger::~Logger() bool Console::sShowTime = false; bool Console::sShowTimeMicros = false; bool Console::sShowTag = false; +#ifndef WIN32 bool Console::sShowPID = false; +#endif std::string Console::sTag; void Console::SetTag(const std::string& rTag) @@ -201,10 +203,12 @@ void Console::SetShowTimeMicros(bool enabled) sShowTimeMicros = enabled; } +#ifndef WIN32 void Console::SetShowPID(bool enabled) { sShowPID = enabled; } +#endif bool Console::Log(Log::Level level, const std::string& rFile, int line, std::string& rMessage) @@ -258,19 +262,23 @@ bool Console::Log(Log::Level level, const std::string& rFile, if (sShowTag) { + #ifndef WIN32 if (sShowPID) { buf << "[" << sTag << " " << getpid() << "] "; } else + #endif { buf << "[" << sTag << "] "; } } + #ifndef WIN32 else if (sShowPID) { buf << "[" << getpid() << "] "; } + #endif if (level <= Log::FATAL) { diff --git a/lib/common/Logging.h b/lib/common/Logging.h index f26fd217..21c23a7e 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -121,7 +121,9 @@ class Console : public Logger static bool sShowTimeMicros; static bool sShowTag; static std::string sTag; + #ifndef WIN32 static bool sShowPID; + #endif public: virtual bool Log(Log::Level level, const std::string& rFile, @@ -132,7 +134,9 @@ class Console : public Logger static void SetTag(const std::string& rTag); static void SetShowTime(bool enabled); static void SetShowTimeMicros(bool enabled); + #ifndef WIN32 static void SetShowPID(bool enabled); + #endif }; // -------------------------------------------------------------------------- diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp index 0f07eac3..62ac0e30 100644 --- a/lib/server/Daemon.cpp +++ b/lib/server/Daemon.cpp @@ -104,9 +104,9 @@ std::string Daemon::GetOptionString() { return "c:" #ifndef WIN32 - "DFk" + "DFkP" #endif - "hPqvVt:TU"; + "hqvVt:TU"; } void Daemon::Usage() @@ -124,8 +124,8 @@ void Daemon::Usage() " -D Debugging mode, do not fork, one process only, one client only\n" " -F Do not fork into background, but fork to serve multiple clients\n" " -k Keep console open after fork, keep writing log messages to it\n" -#endif " -P Show process ID (PID) in console output\n" +#endif " -q Run more quietly, reduce verbosity level by one, can repeat\n" " -v Run more verbosely, increase verbosity level by one, can repeat\n" " -V Run at maximum verbosity\n" @@ -183,11 +183,13 @@ int Daemon::ProcessOption(signed int option) } break; + #ifndef WIN32 case 'P': { Console::SetShowPID(true); } break; + #endif case 'q': { -- cgit v1.2.3