Add default simple logging.
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
#include <opm/common/OpmLog/Logger.hpp>
|
#include <opm/common/OpmLog/Logger.hpp>
|
||||||
|
#include <opm/common/OpmLog/StreamLog.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
@@ -160,6 +162,14 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void OpmLog::setupSimpleDefaultLogging(const bool& use_prefix)
|
||||||
|
{
|
||||||
|
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::DefaultMessageTypes);
|
||||||
|
OpmLog::addBackend( "STREAMLOG", streamLog);
|
||||||
|
streamLog->setMessageLimiter(std::make_shared<MessageLimiter>(10));
|
||||||
|
streamLog->setMessageFormatter(std::make_shared<SimpleMessageFormatter>(use_prefix, true));
|
||||||
|
}
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
std::shared_ptr<Logger> OpmLog::m_logger;
|
std::shared_ptr<Logger> OpmLog::m_logger;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
static void removeAllBackends();
|
static void removeAllBackends();
|
||||||
static bool enabledMessageType( int64_t messageType );
|
static bool enabledMessageType( int64_t messageType );
|
||||||
static void addMessageType( int64_t messageType , const std::string& prefix);
|
static void addMessageType( int64_t messageType , const std::string& prefix);
|
||||||
|
static void setupSimpleDefaultLogging(const bool& use_prefix);
|
||||||
|
|
||||||
template <class BackendType>
|
template <class BackendType>
|
||||||
static std::shared_ptr<BackendType> getBackend(const std::string& name) {
|
static std::shared_ptr<BackendType> getBackend(const std::string& name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user