diff --git a/opm/common/OpmLog/LogUtil.cpp b/opm/common/OpmLog/LogUtil.cpp index 426d31f80..5827a1f82 100644 --- a/opm/common/OpmLog/LogUtil.cpp +++ b/opm/common/OpmLog/LogUtil.cpp @@ -52,6 +52,7 @@ namespace Log { prefix = "debug"; break; case MessageType::Info: + case MessageType::Prtinfo: prefix = "info"; break; case MessageType::Warning: diff --git a/opm/common/OpmLog/LogUtil.hpp b/opm/common/OpmLog/LogUtil.hpp index 76f4ccaa6..d593e9a32 100644 --- a/opm/common/OpmLog/LogUtil.hpp +++ b/opm/common/OpmLog/LogUtil.hpp @@ -32,10 +32,12 @@ namespace Log { const int64_t Error = 8; /* Error in the input data - should probably exit. */ const int64_t Problem = 16; /* Calculation problems - e.g. convergence failure. */ const int64_t Bug = 32; /* An inconsistent state has been encountered in the simulator - should probably exit. */ + const int64_t Prtinfo = 64; /* Information that should only go into print file.*/ } - const int64_t DefaultMessageTypes = MessageType::Debug + MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug; - const int64_t NoDebugMessageTypes = MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug; + const int64_t DefaultMessageTypes = MessageType::Debug + MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug + MessageType::Prtinfo; + const int64_t NoDebugMessageTypes = MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug + MessageType::Prtinfo; + const int64_t StdoutMessageTypes = MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug; /// Terminal codes for ANSI/vt100 compatible terminals. /// See for example http://ascii-table.com/ansi-escape-sequences.php diff --git a/opm/common/OpmLog/Logger.cpp b/opm/common/OpmLog/Logger.cpp index ead6efc3f..12fdb0806 100644 --- a/opm/common/OpmLog/Logger.cpp +++ b/opm/common/OpmLog/Logger.cpp @@ -36,6 +36,7 @@ namespace Opm { addMessageType( Log::MessageType::Error , "error"); addMessageType( Log::MessageType::Problem , "problem"); addMessageType( Log::MessageType::Bug , "bug"); + addMessageType( Log::MessageType::Prtinfo , "prtinfo"); } void Logger::addTaggedMessage(int64_t messageType, const std::string& tag, const std::string& message) const { diff --git a/opm/common/OpmLog/OpmLog.cpp b/opm/common/OpmLog/OpmLog.cpp index 9f67d8517..32203b655 100644 --- a/opm/common/OpmLog/OpmLog.cpp +++ b/opm/common/OpmLog/OpmLog.cpp @@ -81,6 +81,12 @@ namespace Opm { } + void OpmLog::prtinfo(const std::string& message) + { + addMessage(Log::MessageType::Prtinfo, message); + } + + void OpmLog::info(const std::string& tag, const std::string& message) { @@ -119,6 +125,13 @@ namespace Opm { + void OpmLog::prtinfo(const std::string& tag, const std::string& message) + { + addTaggedMessage(Log::MessageType::Prtinfo, tag, message); + } + + + bool OpmLog::enabledMessageType( int64_t messageType ) { if (m_logger) diff --git a/opm/common/OpmLog/OpmLog.hpp b/opm/common/OpmLog/OpmLog.hpp index 0f70e3996..c198b59b9 100644 --- a/opm/common/OpmLog/OpmLog.hpp +++ b/opm/common/OpmLog/OpmLog.hpp @@ -48,6 +48,7 @@ public: static void problem(const std::string& message); static void bug(const std::string& message); static void debug(const std::string& message); + static void prtinfo(const std::string& message); static void info(const std::string& tag, const std::string& message); static void warning(const std::string& tag, const std::string& message); @@ -55,6 +56,7 @@ public: static void problem(const std::string& tag, const std::string& message); static void bug(const std::string& tag, const std::string& message); static void debug(const std::string& tag, const std::string& message); + static void prtinfo(const std::string& tag, const std::string& message); static bool hasBackend( const std::string& backendName ); static void addBackend(const std::string& name , std::shared_ptr backend); diff --git a/tests/test_OpmLog.cpp b/tests/test_OpmLog.cpp index 1bce0c40c..a1bb9a942 100644 --- a/tests/test_OpmLog.cpp +++ b/tests/test_OpmLog.cpp @@ -169,10 +169,12 @@ BOOST_AUTO_TEST_CASE( CounterLogTesting) { counter.addMessage( Log::MessageType::Error , "This is an error ..."); counter.addMessage( Log::MessageType::Warning , "This is a warning"); + counter.addMessage( Log::MessageType::Prtinfo , "This is a info(prtinfo)"); BOOST_CHECK_EQUAL(1U , counter.numMessages( Log::MessageType::Error )); BOOST_CHECK_EQUAL(1U , counter.numMessages( Log::MessageType::Warning )); BOOST_CHECK_EQUAL(0 , counter.numMessages( Log::MessageType::Info )); + BOOST_CHECK_EQUAL(1U , counter.numMessages( Log::MessageType::Prtinfo )); { int64_t not_enabled = 4096; @@ -252,6 +254,7 @@ BOOST_AUTO_TEST_CASE(TestHelperFunctions) // prefixMessage BOOST_CHECK_EQUAL(prefixMessage(MessageType::Error, "message"), "error: message"); BOOST_CHECK_EQUAL(prefixMessage(MessageType::Info, "message"), "info: message"); + BOOST_CHECK_EQUAL(prefixMessage(MessageType::Prtinfo, "message"), "info: message"); // colorCode Message BOOST_CHECK_EQUAL(colorCodeMessage(MessageType::Info, "message"), "message");