Allow disabling output in EclipsePRTLog.

In a parallel run we need to be able to disable output in EclipsePRTLog
as only one process is allowed to output messages. This commit adds a
new defaulted constructor parameter to allow this.
This commit is contained in:
Markus Blatt 2016-09-15 21:22:21 +02:00
parent 37938bbf5e
commit 64c0651ffa
2 changed files with 21 additions and 1 deletions

View File

@ -45,6 +45,11 @@ namespace Opm {
EclipsePRTLog::~EclipsePRTLog()
{
if( ! print_summary_ )
{
return;
}
//output summary.
const std::string summary_msg = "\n\nError summary:" +
std::string("\nWarnings " + std::to_string(numMessages(Log::MessageType::Warning))) +
@ -56,4 +61,14 @@ namespace Opm {
StreamLog::addTaggedMessage(Log::MessageType::Info, "", summary_msg);
}
EclipsePRTLog::EclipsePRTLog(const std::string& logFile , int64_t messageMask,
bool append, bool print_summary)
: StreamLog(logFile, messageMask, append),
print_summary_(print_summary)
{}
EclipsePRTLog::EclipsePRTLog(std::ostream& os , int64_t messageMask,
bool print_summary)
: StreamLog(os, messageMask), print_summary_(print_summary)
{}
}

View File

@ -29,7 +29,6 @@ namespace Opm {
class EclipsePRTLog : public StreamLog {
public:
using StreamLog::StreamLog;
void addTaggedMessage(int64_t messageType, const std::string& messageTag, const std::string& message);
@ -37,8 +36,14 @@ public:
~EclipsePRTLog();
EclipsePRTLog(const std::string& logFile , int64_t messageMask,
bool append, bool print_summary=true);
EclipsePRTLog(std::ostream& os , int64_t messageMask,
bool print_summary=true);
private:
std::map<int64_t, size_t> m_count;
bool print_summary_;
};
}
#endif // ECLIPSEPRTLOG_H