diff --git a/common/log/StdoutLogger.cpp b/common/log/StdoutLogger.cpp index 609a999683b79a9a91bbb49d7f234b17063d6f68..f1fd77ebb59c8702182fc3b744f444ed69f0930a 100644 --- a/common/log/StdoutLogger.cpp +++ b/common/log/StdoutLogger.cpp @@ -23,8 +23,8 @@ namespace log { //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -StdoutLogger::StdoutLogger(const std::string &hostName, const std::string &programName): - Logger(hostName, programName, DEBUG) { +StdoutLogger::StdoutLogger(const std::string &hostName, const std::string &programName, bool simple): + Logger(hostName, programName, DEBUG), m_simple(simple) { } //------------------------------------------------------------------------------ @@ -42,8 +42,13 @@ void StdoutLogger::prepareForFork() {} // writeMsgToUnderlyingLoggingSystem //------------------------------------------------------------------------------ void StdoutLogger::writeMsgToUnderlyingLoggingSystem(const std::string &header, const std::string &body) { - const std::string headerPlusBody = header + body; - printf("%s\n", headerPlusBody.c_str()); + + if (m_simple) { + printf("%s\n", body.c_str()); + } else { + const std::string headerPlusBody = header + body; + printf("%s\n", headerPlusBody.c_str()); + } } } // namespace log diff --git a/common/log/StdoutLogger.hpp b/common/log/StdoutLogger.hpp index 76d9aa9ba1ff05f9e70b28fab5cd030b571f08fa..3cf15763c2d6cfa63afda9a5385c4287c34da717 100644 --- a/common/log/StdoutLogger.hpp +++ b/common/log/StdoutLogger.hpp @@ -34,8 +34,9 @@ public: * @param hostName The name of the host to be prepended to every log message. * @param programName The name of the program to be prepended to every log * message. + * @param simple If true, then logging header is not included. */ - StdoutLogger(const std::string &hostName, const std::string &programName); + StdoutLogger(const std::string &hostName, const std::string &programName, bool simple = false); /** * Destructor. @@ -69,6 +70,9 @@ protected: */ void writeMsgToUnderlyingLoggingSystem(const std::string &header, const std::string &body) override; +private: + bool m_simple; + }; // class StringLogger } // namespace log