mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Check that stdout is attached to terminal before applying color
This commit is contained in:
parent
d94cc2cc30
commit
d2510714e0
@ -26,6 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "readDeck.hpp"
|
#include "readDeck.hpp"
|
||||||
|
|
||||||
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
|
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
|
||||||
#include <opm/common/utility/String.hpp>
|
#include <opm/common/utility/String.hpp>
|
||||||
#include <opm/common/utility/OpmInputError.hpp>
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
@ -151,7 +152,9 @@ FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, con
|
|||||||
if (mpi_rank_ == 0) {
|
if (mpi_rank_ == 0) {
|
||||||
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::StdoutMessageTypes);
|
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::StdoutMessageTypes);
|
||||||
Opm::OpmLog::addBackend(stdout_log_id, streamLog);
|
Opm::OpmLog::addBackend(stdout_log_id, streamLog);
|
||||||
streamLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(true));
|
|
||||||
|
bool use_color_coding = OpmLog::stdoutIsTerminal();
|
||||||
|
streamLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(use_color_coding));
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user