mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-29 16:40:20 -05:00
#12329 Simplify interface for log messages
This commit is contained in:
1 parent
60d2bf0483
commit
380f559f0d
7 files changed
+77
-82
No files matched your search
@@ -230,6 +230,8 @@ RiaPreferencesSystem::EclipseTextFileReaderMode RiaPreferencesSystem::eclipseTex
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferencesSystem::isLoggingActivatedForKeyword( const QString& keyword ) const
|
||||
{
|
||||
if ( keyword.isEmpty() ) return true;
|
||||
|
||||
QStringList keywords = m_keywordsForLogging().split( ";" );
|
||||
|
||||
if ( keywords.contains( "enable-all" ) ) return true;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferencesSystem.h"
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include <iostream>
|
||||
@@ -245,8 +246,10 @@ RILogLevel RiaLogging::logLevelBasedOnPreferences()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::error( const QString& message )
|
||||
void RiaLogging::error( const QString& message, const QString logKeyword )
|
||||
{
|
||||
if ( !RiaPreferencesSystem::current()->isLoggingActivatedForKeyword( logKeyword ) ) return;
|
||||
|
||||
if ( isSameMessage( message ) ) return;
|
||||
|
||||
for ( const auto& logger : sm_logger )
|
||||
@@ -264,8 +267,10 @@ void RiaLogging::error( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::warning( const QString& message )
|
||||
void RiaLogging::warning( const QString& message, const QString logKeyword )
|
||||
{
|
||||
if ( !RiaPreferencesSystem::current()->isLoggingActivatedForKeyword( logKeyword ) ) return;
|
||||
|
||||
if ( isSameMessage( message ) ) return;
|
||||
|
||||
for ( const auto& logger : sm_logger )
|
||||
@@ -283,8 +288,10 @@ void RiaLogging::warning( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::info( const QString& message )
|
||||
void RiaLogging::info( const QString& message, const QString logKeyword )
|
||||
{
|
||||
if ( !RiaPreferencesSystem::current()->isLoggingActivatedForKeyword( logKeyword ) ) return;
|
||||
|
||||
if ( isSameMessage( message ) ) return;
|
||||
|
||||
for ( const auto& logger : sm_logger )
|
||||
@@ -302,8 +309,10 @@ void RiaLogging::info( const QString& message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaLogging::debug( const QString& message )
|
||||
void RiaLogging::debug( const QString& message, const QString logKeyword )
|
||||
{
|
||||
if ( !RiaPreferencesSystem::current()->isLoggingActivatedForKeyword( logKeyword ) ) return;
|
||||
|
||||
if ( isSameMessage( message ) ) return;
|
||||
|
||||
for ( const auto& logger : sm_logger )
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class QString;
|
||||
#include <QString>
|
||||
|
||||
class QWidget;
|
||||
|
||||
enum class RILogLevel
|
||||
@@ -66,10 +67,10 @@ public:
|
||||
|
||||
static RILogLevel logLevelBasedOnPreferences();
|
||||
|
||||
static void error( const QString& message );
|
||||
static void warning( const QString& message );
|
||||
static void info( const QString& message );
|
||||
static void debug( const QString& message );
|
||||
static void error( const QString& message, const QString logKeyword = "" );
|
||||
static void warning( const QString& message, const QString logKeyword = "" );
|
||||
static void info( const QString& message, const QString logKeyword = "" );
|
||||
static void debug( const QString& message, const QString logKeyword = "" );
|
||||
|
||||
static void errorInMessageBox( QWidget* parent, const QString& title, const QString& text );
|
||||
|
||||
|
||||
Reference in new issue
Block a user