#13126 RiaLogging: Use std::string_view instead of QString for logging

This commit is contained in:
Kristian Bendiksen committed 2026-05-08 10:11:09 +02:00
1 parent 4957bf5a8b
commit 5ffcb69acc
231 files changed
+1082 -893

No files matched your search

@@ -41,6 +41,7 @@
#include "RimWellPathValve.h"
#include "RiaLogging.h"
#include "RiaQStringFormatter.h"
#include <algorithm>
#include <limits>
@@ -162,7 +163,7 @@ RigMswBranch buildMainBoreBranchFromGeometry( const RimWellPath*
const double cellLength = std::fabs( cellInfo.endMD - cellInfo.startMD );
if ( cellLength <= segmentLengthThreshold )
{
RiaLogging::info( QString( "Skipping segment, threshold = %1, length = %2" ).arg( segmentLengthThreshold ).arg( cellLength ) );
RiaLogging::info( std::format( "Skipping segment, threshold = {}, length = {}", segmentLengthThreshold, cellLength ) );
continue;
}
@@ -23,6 +23,7 @@
#include "RiaEclipseUnitTools.h"
#include "RiaLogging.h"
#include "RiaQDateTimeTools.h"
#include "RiaQStringFormatter.h"
#include "RigEclipseResultAddress.h"
#include "Summary/RiaSummaryTools.h"
@@ -135,7 +136,7 @@ std::vector<RigCompletionData>
msg += " ";
msg += r;
}
RiaLogging::error( msg );
RiaLogging::error( msg.toStdString() );
return fractureCompletions;
}
@@ -461,8 +462,9 @@ bool RicExportFractureCompletionsImpl::checkForStimPlanConductivity( const RimFr
{
if ( !fracTemplateStimPlan->hasConductivity() )
{
RiaLogging::error( "Trying to export completion data for stimPlan fracture without conductivity data for " + fracture->name() );
RiaLogging::error( "No transmissibilities will be calculated for " + fracture->name() );
RiaLogging::error( "Trying to export completion data for stimPlan fracture without conductivity data for " +
fracture->name().toStdString() );
RiaLogging::error( "No transmissibilities will be calculated for " + fracture->name().toStdString() );
return false;
}
}
@@ -640,7 +642,7 @@ std::vector<cvf::Vec3d> RicExportFractureCompletionsImpl::computeWellPointsInFra
std::vector<cvf::Vec3d> wellPathPoints = wellPathGeometry->wellPathPointsIncludingInterpolatedIntersectionPoint( fracture->fractureMD() );
RiaLogging::info( "Using user-defined perforation length on azimuth fracture." );
RiaLogging::info( QString( "Perforation length: %1" ).arg( fracture->perforationLength() ) );
RiaLogging::info( std::format( "Perforation length: {}", fracture->perforationLength() ) );
double startMd = fracture->fractureMD() - fracture->perforationLength() / 2.0;
double endMd = fracture->fractureMD() + fracture->perforationLength() / 2.0;
@@ -663,15 +665,15 @@ std::vector<cvf::Vec3d> RicExportFractureCompletionsImpl::computeWellPointsInFra
auto vecToString = []( const cvf::Vec3d& vec ) { return QString( "[%1 %2 %3]" ).arg( vec.x() ).arg( vec.y() ).arg( vec.z() ); };
RiaLogging::info( QString( "Start perforation position: %1" ).arg( vecToString( startPos ) ) );
RiaLogging::info( QString( "Start perforation position in fracture plane: %1" ).arg( vecToString( startPosInFracturePlane ) ) );
RiaLogging::info( QString( "Anchor pos: %1" ).arg( vecToString( anchorPosition ) ) );
RiaLogging::info( QString( "Direction anchor to start position in plane: %1" ).arg( vecToString( directionToStartPosInFracturePlane ) ) );
RiaLogging::info( QString( "Direction anchor to original start position: %1" ).arg( vecToString( directionToStartPos ) ) );
RiaLogging::info( std::format( "Start perforation position: {}", vecToString( startPos ) ) );
RiaLogging::info( std::format( "Start perforation position in fracture plane: {}", vecToString( startPosInFracturePlane ) ) );
RiaLogging::info( std::format( "Anchor pos: {}", vecToString( anchorPosition ) ) );
RiaLogging::info( std::format( "Direction anchor to start position in plane: {}", vecToString( directionToStartPosInFracturePlane ) ) );
RiaLogging::info( std::format( "Direction anchor to original start position: {}", vecToString( directionToStartPos ) ) );
// Find the angle between the real direction (tangential to well path) and the fracture plane
double angle = cvf::GeometryTools::getAngle( directionToStartPosInFracturePlane, directionToStartPos );
RiaLogging::info( QString( "Angle: %1 degrees." ).arg( cvf::Math::toDegrees( angle ) ) );
RiaLogging::info( std::format( "Angle: {} degrees.", cvf::Math::toDegrees( angle ) ) );
auto rotMat = cvf::GeometryTools::rotationMatrixBetweenVectors( directionToStartPos, directionToStartPosInFracturePlane );
auto rotatePoint = []( const cvf::Vec3d& point, const cvf::Vec3d& offset, auto rotMat )
@@ -691,11 +693,14 @@ std::vector<cvf::Vec3d> RicExportFractureCompletionsImpl::computeWellPointsInFra
cvf::Vec3d transformedStartPos = rotatePoint( startPos, anchorPosition, rotMat );
RiaLogging::info( QString( "Perforation start position: original: %1 --> adapted: %2" )
.arg( vecToString( startPos ) )
.arg( vecToString( transformedStartPos ) ) );
.arg( vecToString( transformedStartPos ) )
.toStdString() );
cvf::Vec3d transformedEndPos = rotatePoint( endPos, anchorPosition, rotMat );
RiaLogging::info(
QString( "Perforation end position: original: %1 --> adapted: %2" ).arg( vecToString( endPos ) ).arg( vecToString( transformedEndPos ) ) );
RiaLogging::info( QString( "Perforation end position: original: %1 --> adapted: %2" )
.arg( vecToString( endPos ) )
.arg( vecToString( transformedEndPos ) )
.toStdString() );
return wellPathPoints;
}
@@ -574,7 +574,8 @@ void RicMswTableDataTools::generateWsegAicdTableRecursively( RicMswExportInfo&
{
RiaLogging::error( QString( "Export AICD Valve (%1): Valve is invalid. At least one required "
"template parameter is not set." )
.arg( aicd->label() ) );
.arg( aicd->label() )
.toStdString() );
}
}
}
@@ -1029,7 +1030,8 @@ void RicMswTableDataTools::generateWsegSicdTableRecursively( RicMswExportInfo&
{
RiaLogging::error( QString( "Export SICD Valve (%1): Valve is invalid. At least one required "
"template parameter is not set." )
.arg( sicd->label() ) );
.arg( sicd->label() )
.toStdString() );
}
}
}
@@ -20,6 +20,7 @@
#include "RiaLogging.h"
#include "RiaPreferencesSystem.h"
#include "RiaQStringFormatter.h"
#include "RiaWeightedMeanCalculator.h"
#include "RigStatisticsTools.h"
#include "RiuMessageDialog.h"
@@ -113,7 +114,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
if ( !outputDir.mkpath( "." ) )
{
QString errMsg = QString( "Could not create export folder: %1" ).arg( exportSettings.folder );
RiaLogging::error( errMsg );
RiaLogging::error( errMsg.toStdString() );
return;
}
@@ -124,7 +125,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
if ( !fractureTransmissibilityExportInformationFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
RiaLogging::error(
QString( "Export Completions Data: Could not open the file: %1" ).arg( fractureTransmisibillityExportInformationPath ) );
std::format( "Export Completions Data: Could not open the file: {}", fractureTransmisibillityExportInformationPath ) );
}
else
{
@@ -173,7 +174,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
int caseId = exportSettings.caseToApply->caseId();
QString format = QString( "Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"" );
QString errMsg = format.arg( wellPath->name() ).arg( caseId );
RiaLogging::error( errMsg );
RiaLogging::error( errMsg.toStdString() );
}
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellAllCompletionTypes;
@@ -447,7 +448,7 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
QString errorMessage = QString( "Invalid or negative transmissibility value (%1) in cell %3" )
.arg( transmissibility )
.arg( cellIndexIJK.oneBasedLocalCellIndexString() );
RiaLogging::error( errorMessage );
RiaLogging::error( errorMessage.toStdString() );
resultCompletion.addMetadata( "ERROR", errorMessage );
continue;
}
@@ -490,7 +491,7 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
{
QString errorMessage =
QString( "Cannot combine completions of different types in same cell %1" ).arg( cellIndexIJK.oneBasedLocalCellIndexString() );
RiaLogging::error( errorMessage );
RiaLogging::error( errorMessage.toStdString() );
resultCompletion.addMetadata( "ERROR", errorMessage );
return resultCompletion; // Returning empty completion, should not be exported
}
@@ -499,7 +500,7 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
{
QString errorMessage =
QString( "Transmissibility calculation has failed for cell %1" ).arg( cellIndexIJK.oneBasedLocalCellIndexString() );
RiaLogging::error( errorMessage );
RiaLogging::error( errorMessage.toStdString() );
resultCompletion.addMetadata( "ERROR", errorMessage );
return resultCompletion; // Returning empty completion, should not be exported
}
@@ -893,7 +894,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables(
}
}
RiaLogging::info( QString( "Successfully exported completion data to %1" ).arg( exportFile->fileName() ) );
RiaLogging::info( std::format( "Successfully exported completion data to {}", exportFile->fileName() ) );
}
//--------------------------------------------------------------------------------------------------
@@ -45,11 +45,11 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFile( const QS
{
bool createdPath = exportFolder.mkpath( "." );
if ( createdPath )
RiaLogging::info( "Created export folder " + folderName );
RiaLogging::info( "Created export folder " + folderName.toStdString() );
else
{
auto errorMessage = QString( "Selected output folder does not exist, and could not be created." );
RiaLogging::error( errorMessage );
RiaLogging::error( errorMessage.toStdString() );
return nullptr;
}
}
@@ -60,7 +60,7 @@ std::shared_ptr<QFile> RicWellPathExportCompletionsFileTools::openFile( const QS
if ( !exportFile->open( QIODevice::WriteOnly | QIODevice::Text ) )
{
auto errorMessage = QString( "Export Completions Data: Could not open the file: %1" ).arg( filePath );
RiaLogging::error( errorMessage );
RiaLogging::error( errorMessage.toStdString() );
return nullptr;
}
return exportFile;
@@ -19,6 +19,7 @@
#include "RicWellPathExportMswTableData.h"
#include "RiaLogging.h"
#include "RiaQStringFormatter.h"
#include "MswExport/RicWellPathExportMswGeometryPath.h"
#include "RicExportCompletionDataSettingsUi.h"
@@ -632,11 +633,11 @@ bool RicWellPathExportMswTableData::generateWellSegmentsForMswExportInfo( const
if ( hasIntersection )
{
RiaLogging::error( QString( "Valve overlap detected for perforation interval : %1" ).arg( perfInterval->name() ) );
RiaLogging::error( std::format( "Valve overlap detected for perforation interval : {}", perfInterval->name() ) );
RiaLogging::error( "Name of valves" );
RiaLogging::error( valve->name() );
RiaLogging::error( otherValve->name() );
RiaLogging::error( valve->name().toStdString() );
RiaLogging::error( otherValve->name().toStdString() );
RiaLogging::error( "Failed to export well segments" );
@@ -910,7 +911,7 @@ void RicWellPathExportMswTableData::createWellPathSegments( gsl::not_null<RicMsw
else
{
QString text = QString( "Skipping segment , threshold = %1, length = %2" ).arg( segmentLengthThreshold ).arg( segmentLength );
RiaLogging::info( text );
RiaLogging::info( text.toStdString() );
}
}
}