mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-24 19:06:26 -06:00
setting up logging so flowexp variants can report parsing errors
This commit is contained in:
parent
9c74c4d638
commit
4754f63d62
@ -36,6 +36,8 @@
|
|||||||
#include <opm/models/utils/terminal.hpp>
|
#include <opm/models/utils/terminal.hpp>
|
||||||
#include <opm/models/utils/simulator.hh>
|
#include <opm/models/utils/simulator.hh>
|
||||||
|
|
||||||
|
#include <opm/simulators/utils/readDeck.hpp>
|
||||||
|
|
||||||
#include <opm/material/common/ResetLocale.hpp>
|
#include <opm/material/common/ResetLocale.hpp>
|
||||||
|
|
||||||
#include <dune/common/parallel/mpihelper.hh>
|
#include <dune/common/parallel/mpihelper.hh>
|
||||||
@ -226,6 +228,10 @@ static inline int start(int argc, char **argv, bool registerParams=true)
|
|||||||
#else
|
#else
|
||||||
myRank = Dune::MPIHelper::instance(argc, argv).rank();
|
myRank = Dune::MPIHelper::instance(argc, argv).rank();
|
||||||
#endif
|
#endif
|
||||||
|
// setting up backend for STDCOUT logger
|
||||||
|
if (myRank == 0) {
|
||||||
|
setupStreamLogging("STDOUT_LOGGER");
|
||||||
|
}
|
||||||
|
|
||||||
// read the initial time step and the end time
|
// read the initial time step and the end time
|
||||||
Scalar endTime = Parameters::Get<Parameters::EndTime<Scalar>>();
|
Scalar endTime = Parameters::Get<Parameters::EndTime<Scalar>>();
|
||||||
|
@ -515,15 +515,7 @@ Opm::setupLogging(Parallel::Communication& comm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (comm.rank() == 0) {
|
if (comm.rank() == 0) {
|
||||||
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::StdoutMessageTypes);
|
setupStreamLogging(stdout_log_id);
|
||||||
Opm::OpmLog::addBackend(stdout_log_id, streamLog);
|
|
||||||
// Set a tag limit of 10 (no category limit). Will later in
|
|
||||||
// the run be replaced by calling setupMessageLimiter(), after
|
|
||||||
// the deck is read and the (possibly user-set) category
|
|
||||||
// limits are known.
|
|
||||||
streamLog->setMessageLimiter(std::make_shared<Opm::MessageLimiter>(10));
|
|
||||||
bool use_color_coding = OpmLog::stdoutIsTerminal();
|
|
||||||
streamLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(use_color_coding));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -664,3 +656,16 @@ std::unique_ptr<Opm::ParseContext> Opm::setupParseContext(const bool strictParsi
|
|||||||
|
|
||||||
return parseContext;
|
return parseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Opm::setupStreamLogging(const std::string& stdout_log_id)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::StdoutMessageTypes);
|
||||||
|
Opm::OpmLog::addBackend(stdout_log_id, streamLog);
|
||||||
|
// Set a tag limit of 10 (no category limit). Will later in
|
||||||
|
// the run be replaced by calling setupMessageLimiter(), after
|
||||||
|
// the deck is read and the (possibly user-set) category
|
||||||
|
// limits are known.
|
||||||
|
streamLog->setMessageLimiter(std::make_shared<Opm::MessageLimiter>(10));
|
||||||
|
const bool use_color_coding = OpmLog::stdoutIsTerminal();
|
||||||
|
streamLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(use_color_coding));
|
||||||
|
}
|
||||||
|
@ -67,6 +67,9 @@ prepareResultOutputDirectory(const std::string& baseName, const std::filesystem:
|
|||||||
|
|
||||||
std::unique_ptr<ParseContext> setupParseContext(const bool exitOnAllErrors);
|
std::unique_ptr<ParseContext> setupParseContext(const bool exitOnAllErrors);
|
||||||
|
|
||||||
|
// Setup the OpmLog backends for screen output
|
||||||
|
void setupStreamLogging(const std::string& stdout_log_id);
|
||||||
|
|
||||||
// Setup the OpmLog backends
|
// Setup the OpmLog backends
|
||||||
FileOutputMode
|
FileOutputMode
|
||||||
setupLogging(Parallel::Communication& comm,
|
setupLogging(Parallel::Communication& comm,
|
||||||
|
Loading…
Reference in New Issue
Block a user