Loading...
Searching...
No Matches
Opm::OpmLog Class Reference

## Static Public Member Functions

static void | addMessage (int64_t messageFlag, const std::string &message)
static void | addTaggedMessage (int64_t messageFlag, const std::string &tag, const std::string &message)
static void | info (const std::string &message)
static void | warning (const std::string &message)
static void | error (const std::string &message)
static void | problem (const std::string &message)
static void | bug (const std::string &message)
static void | debug (const std::string &message, const int verbosity_level=defaultDebugVerbosityLevel)
static void | note (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)
static void | error (const std::string &tag, const std::string &message)
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 | note (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< LogBackend > backend)
static bool | removeBackend (const std::string &name)
static void | removeAllBackends ()
static bool | enabledMessageType (int64_t messageType)
static void | addMessageType (int64_t messageType, const std::string &prefix)
static int | getDebugVerbosityLevel ()
static void | setDebugVerbosityLevel (const int verbosity_level)
static void | setupSimpleDefaultLogging (const bool use_prefix=true, const bool use_color_coding=true, const int message_limit=10)
| Create a basic logging setup that will send all log messages to standard output.
template<class BackendType>
static std::shared_ptr< BackendType > | getBackend (const std::string &name)
template<class BackendType>
static std::shared_ptr< BackendType > | popBackend (const std::string &name)
static bool | stdoutIsTerminal ()
static bool | setLogger (std::shared_ptr< Logger > logger)
| Sets the global logger instance for the OpmLog class.

## Static Public Attributes

static constexpr int | defaultDebugVerbosityLevel = 1

## Member Function Documentation

## setLogger()

bool Opm::OpmLog::setLogger | ( | std::shared_ptr< Logger > | logger | ) |

static

Sets the global logger instance for the OpmLog class.

This static function allows setting a shared pointer to a Logger instance as the global logger. It ensures that the logger is set only if it has not been previously set or if the provided logger is the same as the existing one. This function prevents changing the logger once it has been set to a different instance. If the logger is already set to a different instance, the function will return false.

Parameters

  logger | A std::shared_ptr to a Logger instance that will be set as the global logger.

Returns
  true if the logger was successfully set or if the same logger was already set. false if a different logger had already been set and the new logger could not be set.

## setupSimpleDefaultLogging()

void Opm::OpmLog::setupSimpleDefaultLogging | ( | const bool | use_prefix = true,
|  | const bool | use_color_coding = true,
|  | const int | message_limit = 10 )

static

Create a basic logging setup that will send all log messages to standard output.

By default category prefixes will be printed (i.e. Error: or Warning:), color coding will be used, and a maximum of 10 messages with the same tag will be printed. These settings can be controlled by the function parameters.

The documentation for this class was generated from the following files:

- opm/common/OpmLog/OpmLog.hpp
- opm/common/OpmLog/OpmLog.cpp