Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
c846586
creation of an object header that logs errors and warnings in a yaml …
amandinehry Apr 25, 2025
f1713fa
Set up ErrorHandling
amandinehry Apr 30, 2025
4e5250f
traits errors commented (to treat)
amandinehry Apr 30, 2025
94b775c
Set up test
amandinehry Apr 30, 2025
1cb8aa3
Modification to properly format the yaml so that it can be parsed if …
amandinehry Apr 30, 2025
9d5e16a
Test to add variadic arguments
amandinehry May 2, 2025
2f7660c
draft: retrieve data contexts info
amandinehry May 5, 2025
6036551
Added additional information in the yaml - not functional missing the…
amandinehry May 5, 2025
46b4904
First attempt at outputting exceptions
amandinehry May 7, 2025
e1aed93
Complete: code for outputting errors into yaml
amandinehry May 9, 2025
bc953be
Manage the text contained in the potential exception
amandinehry May 12, 2025
1a434bc
First attempt: Handling the text contained in the potential exception…
amandinehry May 14, 2025
acf4d99
Complete: yaml output for PVT tables error
amandinehry May 16, 2025
ee58884
YAML error message well formatted
amandinehry May 19, 2025
32a0237
Fix duplication error
amandinehry May 19, 2025
589270f
Add variadic parameters to GEOS_THROW_CTX_IF
amandinehry May 21, 2025
9b65581
Reorganization after operational tests
amandinehry May 21, 2025
b13f0a6
Apply the output error functionality in yaml to all geos errors
amandinehry May 21, 2025
6de2c6a
Latest update for exception handling (try/catch in main)
amandinehry May 27, 2025
5830aee
Add priority to the error message into the yaml file
amandinehry May 27, 2025
2b27c41
Update of the commit named "latest update for exception handling (try…
amandinehry May 27, 2025
86f793e
set priority
amandinehry May 27, 2025
8a8117e
errors cli modification: add --errors-output
amandinehry May 27, 2025
2c0f5aa
errors cli modification: add --errors-output
amandinehry May 27, 2025
eb2f691
Replace original macros
amandinehry May 27, 2025
7b5f293
Correction: replace original macros
amandinehry May 27, 2025
c07b502
Modification of the Optional function to accept arguments separated b…
amandinehry Jun 2, 2025
670ddfa
Reacting with the command line option -e / --errors-output
amandinehry Jun 2, 2025
d08a30f
Add the rank on which the error is catch for error and warning outputs
amandinehry Jun 3, 2025
5a6c1a0
Unit test to check if the contents of the yaml file match exactly wha…
amandinehry Jun 3, 2025
4928dcd
Add the "Exception" field into the message type enumeration
amandinehry Jun 4, 2025
02dcf50
Modify the macros corresponding to throw to allow the exception to be…
amandinehry Jun 4, 2025
59ac94d
Remove ASSERT dependency on LvArray
amandinehry Jun 4, 2025
835e444
Remove GEOS_THROW_(...) and GEOS_ERROR_(...) dependency on LvArray
amandinehry Jun 4, 2025
10a2627
Restore to its original state an input file that I used for my tests
amandinehry Jun 4, 2025
9bd9f30
Delete additionnal spaces
amandinehry Jun 4, 2025
c9fea30
Syntax fixes
amandinehry Jun 4, 2025
7fa2b74
Syntax fixes
amandinehry Jun 4, 2025
8a9ff29
xsd + revert comment
amandinehry Jun 4, 2025
c1e001e
xsd + check includes
amandinehry Jun 4, 2025
e31f17c
Merge remote-tracking branch 'upstream/develop' into feature/amandine…
amandinehry Jun 4, 2025
a0eefd2
Compilation error fix
amandinehry Jun 5, 2025
5caa099
Remove vscode config files
amandinehry Jun 5, 2025
7aee0c6
Remove empty comment lines and commented code
amandinehry Jun 10, 2025
80bb07b
Changes in macros names
amandinehry Jun 10, 2025
149789e
Change the loop syntax ito a for-each syntax to solve the issue of in…
amandinehry Jun 10, 2025
74de273
Add comments
amandinehry Jun 10, 2025
92e6854
Reorganization of declarations
amandinehry Jun 10, 2025
f910d0e
add g_ before global variables + add comment to the addToMsg() method
amandinehry Jun 10, 2025
67fce43
Fix in writing the stack trace in the yaml
amandinehry Jun 11, 2025
387687d
Merge remote-tracking branch 'origin/develop' into feature/amandinehr…
amandinehry Jun 11, 2025
5c801a5
Add an error msg when the call stack is not formatted as expected + r…
amandinehry Jun 11, 2025
e34c90d
Add comment in the write() function
amandinehry Jun 11, 2025
5c4fbcb
Modification of the streamMultilineYamlAttribute() function: no longe…
amandinehry Jun 11, 2025
75eff27
Modification of the streamMultilineYamlAttribute() method: take the i…
amandinehry Jun 11, 2025
dab2da5
Fix null pointer access on parent by using instance field instead
amandinehry Jun 11, 2025
0a95296
Add comments
amandinehry Jun 11, 2025
c4a002e
Just silently kill GEOS when a NotAnError is raised
amandinehry Jun 11, 2025
cbc5102
Removed the pointer to an Error Logger object (this is no longer usef…
amandinehry Jun 12, 2025
3318d85
Minor syntax modification
amandinehry Jun 12, 2025
343b830
Renaming ContextInfo in ErrorContext + minor correction on the format…
amandinehry Jun 12, 2025
e22e538
Minor modifications on the GEOS_THROW_IF_GT_MSG message
amandinehry Jun 12, 2025
8de9060
Using GEOS_LOG_RANK instead of GEOS_LOG
amandinehry Jun 12, 2025
6c762e7
Add an enumeration to secure the keys that can be entered for the map…
amandinehry Jun 12, 2025
d288490
Improved code comments
amandinehry Jun 13, 2025
99d9b5b
reverse the change from GEOS_LOG to GEOS_LOG_RANK +empty the object a…
amandinehry Jun 13, 2025
f929f97
minor changes syntax + remove isValidStackTrace() method and replace …
amandinehry Jun 13, 2025
709d8a4
Minor changes: string to string_view when it was possible + add an ad…
amandinehry Jun 16, 2025
051e85b
Remove try/catch in the createFile() and the flushCurrentErrorMsg() m…
amandinehry Jun 16, 2025
517782b
Renaming: flushCurrentErrorMsg() into flushErrorMsg()
amandinehry Jun 16, 2025
2e0e396
Change GEOS_LOG() to GEOS_LOG_RANK()
amandinehry Jun 18, 2025
a83a3a1
initialize the error message line by default
amandinehry Jun 19, 2025
9fe289a
Doxygen comments
amandinehry Jun 24, 2025
da7dc82
Comments added
amandinehry Jun 24, 2025
260133e
Sort contextual information by decreasing priority
amandinehry Jun 24, 2025
e0c876f
Simplification of the for loop which write context information
amandinehry Jun 24, 2025
e1a2128
Changes following comments received on my PR
amandinehry Jun 25, 2025
4811b6c
Unit test implemented
amandinehry Jun 25, 2025
4a8ea5b
evaluate MSG only one time in macros
amandinehry Jul 4, 2025
2b38577
Merge commit '7e85e747ec65cd498ba0e9e4730f79d2692ed0bd' into feature/…
MelReyCG Jul 8, 2025
127f38e
Merge branch 'feature/amandinehry/create-yaml-file-and-structure' of …
amandinehry Jul 21, 2025
e9508f5
Merge remote-tracking branch 'upstream/develop' into feature/amandine…
amandinehry Jul 21, 2025
7fc0ced
🔊 warn the deveveloppers that a yamlFile should not be written if not…
MelReyCG Jul 21, 2025
35f7686
🐛 ⏪ set the --errorsOutput mandatory because of bug + revert optionpa…
MelReyCG Jul 23, 2025
31842a5
✏️ typo
MelReyCG Jul 25, 2025
a1105e4
🎨 uncrustify
MelReyCG Aug 1, 2025
c118dd4
🎨 docs alignement
MelReyCG Aug 1, 2025
4215fad
🎨 format
MelReyCG Aug 1, 2025
507ac66
builder pattern for addContextInfo
MelReyCG Aug 1, 2025
7b4ec52
♻️ refactor of the test: keeping only necessary testing, separated te…
MelReyCG Aug 1, 2025
a01d8ac
🐛 bugfix for test, wrong global instance impacting
MelReyCG Aug 1, 2025
d4c465b
🎨 format
MelReyCG Aug 1, 2025
1e32d65
Merge remote-tracking branch 'origin/develop' into feature/amandinehr…
MelReyCG Aug 1, 2025
6d10e3a
⏪ restored "Rank N:" if error messages
MelReyCG Aug 1, 2025
e9cd64c
test
amandinehry Aug 7, 2025
c7031bf
Merge branch 'feature/amandinehry/create-yaml-file-and-structure' of …
amandinehry Aug 7, 2025
e07d0b7
uncomment the rmoveFile() function
amandinehry Aug 21, 2025
785636b
stack trace management
amandinehry Aug 21, 2025
dd3b844
Merge remote-tracking branch 'amandinehryFork/develop' into feature/a…
MelReyCG Aug 26, 2025
e0bad67
♻️ ✅ New GEOS_ERROR macros with context included + new unit macro uni…
MelReyCG Sep 15, 2025
ab40edc
✅ ♻️ Simplifying + testing macros (GEOS_ERROR_* and GEOS_ASSERT_*) + …
MelReyCG Sep 18, 2025
faa84fa
📝 adding macro docs
MelReyCG Sep 18, 2025
dd97f0e
✨ ✅ adding error cause in unit test
MelReyCG Sep 18, 2025
d708cac
♻️ reordered error & throw macro to group them
MelReyCG Sep 18, 2025
66ab5cb
♻️ ✅ uniformized warning macros
MelReyCG Sep 19, 2025
e6135b1
✅ 🐛 ⚡️ bugfix when callstack is empty + disable callstack for perfs
MelReyCG Sep 19, 2025
589fcfe
♻️ ✅ uniformized throw macros
MelReyCG Sep 19, 2025
6fc4b30
✅ removing _CTX macros from unit test
MelReyCG Sep 22, 2025
77f9fcb
🐛 use streamed cause string to support mpi pointers formatting (not s…
MelReyCG Sep 22, 2025
5747e7f
🐛 last mistake?
MelReyCG Sep 22, 2025
10eb969
♻️ removing all GEOS_*_CTX macros (as GEOS_ERROR, GEOS_WARNING, GEOS_…
MelReyCG Sep 22, 2025
2c5c5f5
🎨 UNCRUSTIFY
MelReyCG Sep 23, 2025
d1642e6
Merge remote-tracking branch 'origin/develop' into feature/amandinehr…
MelReyCG Sep 23, 2025
b3cbb99
Merge remote-tracking branch 'origin/develop' into feature/amandinehr…
MelReyCG Sep 23, 2025
5781a78
✨ allowing to re-throw with GEOS_THROW* macros
MelReyCG Sep 23, 2025
db75e45
📦 shema
MelReyCG Sep 23, 2025
e07ab72
♻️ removing unintended BASE::
MelReyCG Sep 23, 2025
754ed03
Merge remote-tracking branch 'origin/develop' into refactor/dudes/err…
arng40 Sep 24, 2025
83d0c0f
xsd
arng40 Sep 24, 2025
d5d8615
Merge remote-tracking branch 'origin/feature/amandinehry/create-yaml-…
arng40 Sep 24, 2025
1913059
🎨 uncrustify
MelReyCG Sep 25, 2025
6692dd2
🐛 fix stream reset
MelReyCG Sep 25, 2025
29f6fbe
⚰️ unused variable
MelReyCG Sep 25, 2025
d17972f
✨ removing last LVARRAY_* error logging macros
MelReyCG Sep 25, 2025
759e9bb
Merge remote-tracking branch 'origin/develop' into feature/amandinehr…
MelReyCG Sep 25, 2025
1b755b5
✨ removing last LVARRAY_* error logging macros
MelReyCG Sep 25, 2025
3786db4
✅ adapting test with error cause addition
MelReyCG Sep 25, 2025
efa89d8
🐛 GPU Macros Support
MelReyCG Sep 25, 2025
7915205
🎨 uncrustify
MelReyCG Sep 26, 2025
14eefee
Merge branch 'develop' into feature/amandinehry/create-yaml-file-and-…
MelReyCG Sep 26, 2025
500bbfd
🐛 GPU forgotten instruction
MelReyCG Sep 26, 2025
fa8fa54
🐛 added pragmas to manual shadow global logger instance
MelReyCG Sep 26, 2025
a29510b
Merge branch 'feature/amandinehry/create-yaml-file-and-structure-2' o…
MelReyCG Sep 26, 2025
c501a0f
🐛 wrong conversion on GPU
MelReyCG Sep 29, 2025
a07810f
Merge branch 'develop' into feature/amandinehry/create-yaml-file-and-…
MelReyCG Sep 29, 2025
cbb5322
centralize error output
arng40 Sep 29, 2025
c743e15
remvove deplucated log
arng40 Sep 30, 2025
dc13b33
Merge remote-tracking branch 'origin/feature/amandinehry/create-yaml-…
arng40 Sep 30, 2025
355e765
remove rank from arg
arng40 Oct 7, 2025
276606c
Merge remote-tracking branch 'origin/develop' into refactor/dudes/err…
arng40 Nov 5, 2025
3253a0b
fix after merge
arng40 Nov 5, 2025
cf0afc5
doc & fix
arng40 Nov 5, 2025
efcc52d
fix test
arng40 Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 58 additions & 53 deletions src/coreComponents/common/logger/ErrorHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ ErrorLogger::ErrorMsg & ErrorLogger::ErrorMsg::addRank( int rank )
ErrorLogger::ErrorMsg & ErrorLogger::ErrorMsg::addCallStackInfo( std::string_view ossStackTrace )
{
std::string str = std::string( ossStackTrace );
m_stringCallStack = str;
std::istringstream iss( str );
std::string stackLine;
std::size_t index;
Expand Down Expand Up @@ -188,74 +189,78 @@ void ErrorLogger::streamMultilineYamlAttribute( std::string_view msg, std::ofstr
}
}

void ErrorLogger::flushErrorMsg( ErrorLogger::ErrorMsg & errorMsg )
void ErrorLogger::flushErrorMsg( ErrorLogger::ErrorMsg & errorMsg, std::ostringstream & msgoss )
{
std::ofstream yamlFile( std::string( m_filename ), std::ios::app );
if( yamlFile.is_open() && isOutputFileEnabled() )
if( isOutputFileEnabled() )
{
// General errors info (type, rank on which the error occured)
yamlFile << g_level1Start << "type: " << ErrorLogger::toString( errorMsg.m_type ) << "\n";
yamlFile << g_level1Next << "rank: " << stringutilities::join( errorMsg.m_ranksInfo, "," );
yamlFile << "\n";
std::ofstream yamlFile( std::string( m_filename ), std::ios::app );
if( yamlFile.is_open() && isOutputFileEnabled() )
{
// General errors info (type, rank on which the error occured)
yamlFile << g_level1Start << "type: " << ErrorLogger::toString( errorMsg.m_type ) << "\n";
yamlFile << g_level1Next << "rank: " << stringutilities::join( errorMsg.m_ranksInfo, "," );
yamlFile << "\n";

// Error message
yamlFile << g_level1Next << "message: >-\n";
streamMultilineYamlAttribute( errorMsg.m_msg, yamlFile, g_level2Next );
// Error message
yamlFile << g_level1Next << "message: >-\n";
streamMultilineYamlAttribute( errorMsg.m_msg, yamlFile, g_level2Next );

// context information
if( !errorMsg.m_contextsInfo.empty() )
{
// Sort contextual information by decreasing priority
std::sort( errorMsg.m_contextsInfo.begin(), errorMsg.m_contextsInfo.end(),
[]( const ErrorLogger::ErrorContext & a, const ErrorLogger::ErrorContext & b ) {
return a.m_priority > b.m_priority;
} );
// Additional informations about the context of the error and priority information of each context
yamlFile << g_level1Next << "contexts:\n";
for( ErrorContext const & ctxInfo : errorMsg.m_contextsInfo )
// context information
if( !errorMsg.m_contextsInfo.empty() )
{
yamlFile << g_level3Start << "priority: " << ctxInfo.m_priority << "\n";
for( auto const & [key, value] : ctxInfo.m_attributes )
// Sort contextual information by decreasing priority
std::sort( errorMsg.m_contextsInfo.begin(), errorMsg.m_contextsInfo.end(),
[]( const ErrorLogger::ErrorContext & a, const ErrorLogger::ErrorContext & b ) {
return a.m_priority > b.m_priority;
} );
// Additional informations about the context of the error and priority information of each context
yamlFile << g_level1Next << "contexts:\n";
for( ErrorContext const & ctxInfo : errorMsg.m_contextsInfo )
{
yamlFile << g_level3Next << ErrorContext::attributeToString( key ) << ": " << value << "\n";
yamlFile << g_level3Start << "priority: " << ctxInfo.m_priority << "\n";
for( auto const & [key, value] : ctxInfo.m_attributes )
{
yamlFile << g_level3Next << ErrorContext::attributeToString( key ) << ": " << value << "\n";
}
}
}
}

// error cause
if( !errorMsg.m_cause.empty() )
{
yamlFile << g_level1Next << "cause: >-\n";
streamMultilineYamlAttribute( errorMsg.m_cause, yamlFile, g_level2Next );
}
// error cause
if( !errorMsg.m_cause.empty() )
{
yamlFile << g_level1Next << "cause: >-\n";
streamMultilineYamlAttribute( errorMsg.m_cause, yamlFile, g_level2Next );
}

// Location of the error in the code
yamlFile << g_level1Next << "sourceLocation:\n";
yamlFile << g_level2Next << "file: " << errorMsg.m_file << "\n";
yamlFile << g_level2Next << "line: " << errorMsg.m_line << "\n";
// Location of the error in the code
yamlFile << g_level1Next << "sourceLocation:\n";
yamlFile << g_level2Next << "file: " << errorMsg.m_file << "\n";
yamlFile << g_level2Next << "line: " << errorMsg.m_line << "\n";

// Information about the stack trace
if( !errorMsg.m_sourceCallStack.empty() )
{
yamlFile << g_level1Next << "sourceCallStack:\n";
for( size_t i = 0; i < errorMsg.m_sourceCallStack.size(); i++ )
// Information about the stack trace
if( !errorMsg.m_sourceCallStack.empty() )
{
yamlFile << ( errorMsg.isValidStackTrace() ?
GEOS_FMT( "{}frame{}: {}\n", g_level3Start, i, errorMsg.m_sourceCallStack[i] ) :
GEOS_FMT( "{}{}\n", g_level3Start, errorMsg.m_sourceCallStack[i] ) );
yamlFile << g_level1Next << "sourceCallStack:\n";
for( size_t i = 0; i < errorMsg.m_sourceCallStack.size(); i++ )
{
yamlFile << ( errorMsg.isValidStackTrace() ?
GEOS_FMT( "{}frame{}: {}\n", g_level3Start, i, errorMsg.m_sourceCallStack[i] ) :
GEOS_FMT( "{}{}\n", g_level3Start, errorMsg.m_sourceCallStack[i] ) );
}
}
}

yamlFile << "\n";
yamlFile.flush();
errorMsg = ErrorMsg();
GEOS_LOG_RANK( GEOS_FMT( "The error file {} was appended.", m_filename ) );
}
else
{
GEOS_LOG_RANK( GEOS_FMT( "Unable to open error file for writing.\n- Error file: {}\n- Error file enabled = {}.\n",
m_filename, isOutputFileEnabled() ) );
yamlFile << "\n";
yamlFile.flush();
errorMsg = ErrorMsg();
GEOS_LOG_RANK( GEOS_FMT( "The error file {} was appended.", m_filename ) );
}
else
{
GEOS_LOG_RANK( GEOS_FMT( "Unable to open error file for writing.\n- Error file: {}\n- Error file enabled = {}.\n",
m_filename, g_errorLogger.isOutputFileEnabled() ) );
}
}
ErrorLogger::formatMsgToAscii( errorMsg, ::geos::logger::internal::g_rankString, msgoss );
}

} /* namespace geos */
25 changes: 23 additions & 2 deletions src/coreComponents/common/logger/ErrorHandling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "common/DataTypes.hpp"


namespace geos
{

Expand All @@ -37,7 +38,7 @@ class ErrorLogger
* @enum MsgType
* Enum listing the different types of possible errors
*/
enum class MsgType
enum class MsgType : integer
{
Error,
Warning,
Expand Down Expand Up @@ -117,6 +118,9 @@ class ErrorLogger
std::vector< ErrorContext > m_contextsInfo;
/// the stack trace
std::vector< std::string > m_sourceCallStack;
/// the string stack trace
std::string m_stringCallStack;


/**
* @brief Construct a default Error Message
Expand Down Expand Up @@ -218,6 +222,23 @@ class ErrorLogger
bool m_isValidStackTrace = false;
};

/**
* @brief Retrieve all informations from the ErrorLogger and format into an ascii message
* @param errMsg Class containing all the error/warning information
* @param rank The rank where the error/warning happened
* @param msgoss The output stream. By default std::cout
*/
static void formatMsgToAscii( ErrorLogger::ErrorMsg const & errMsg, string const & rank,
std::ostringstream & msgoss )
{

msgoss << "***** " << ErrorLogger::toString( errMsg.m_type ) << "\n";
msgoss << "***** LOCATION: " << errMsg.m_file<< "\n";
msgoss << "***** " << errMsg.m_cause << "\n";
msgoss << "***** Rank " << rank << ": " << errMsg.m_msg << "\n";
msgoss << errMsg.m_stringCallStack;
}

/**
* @return Global instance of the ErrorLogger class used for error/warning reporting.
* @details This global instance is used across the codebase to log errors, warnings, and exceptions,
Expand Down Expand Up @@ -281,7 +302,7 @@ class ErrorLogger
* and reset the errorMsg instance to its initial state
* @param errorMsg a constant reference to the error
*/
void flushErrorMsg( ErrorMsg & errorMsg );
void flushErrorMsg( ErrorMsg & errorMsg, std::ostringstream & oss );

private:
/// The error constructed via exceptions
Expand Down
136 changes: 53 additions & 83 deletions src/coreComponents/common/logger/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,36 +156,24 @@
{ \
if( COND ) \
{ \
std::ostringstream __msgoss; \
__msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
std::string __message = __msgoss.str(); \
__msgoss = std::ostringstream(); \
__msgoss << CAUSE_MESSAGE; \
std::string __cause = __msgoss.str(); \
std::ostringstream __oss; \
__oss << "***** ERROR\n"; \
__oss << "***** LOCATION: " LOCATION "\n"; \
__oss << "***** " << __cause << "\n"; \
__oss << "***** Rank " << ::geos::logger::internal::g_rankString << ": " << __message << "\n"; \
std::string stackHistory = LvArray::system::stackTrace( true ); \
__oss << stackHistory; \
std::cout << __oss.str() << std::endl; \
if( GEOS_ERROR_LOGGER_INSTANCE.isOutputFileEnabled() ) \
{ \
ErrorLogger::ErrorMsg msgStruct( ErrorLogger::MsgType::Error, \
__message, \
::geos::logger::internal::g_rank, \
__FILE__, \
__LINE__ ); \
msgStruct.setCause( __cause ); \
msgStruct.addCallStackInfo( stackHistory ); \
msgStruct.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
GEOS_ERROR_LOGGER_INSTANCE.flushErrorMsg( msgStruct ); \
} \
std::ostringstream flushoss; \
std::ostringstream msgoss; \
msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
std::ostringstream causemsgsoss; \
causemsgsoss << CAUSE_MESSAGE; \
ErrorLogger::ErrorMsg msgStruct( ErrorLogger::MsgType::Error, \
msgoss.str(), \
::geos::logger::internal::g_rank, \
__FILE__, \
__LINE__ ); \
msgStruct.setCause( causemsgsoss.str() ); \
msgStruct.addCallStackInfo( LvArray::system::stackTrace( true ) ); \
msgStruct.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
GEOS_ERROR_LOGGER_INSTANCE.flushErrorMsg( msgStruct, flushoss ); \
LvArray::system::callErrorHandler(); \
} \
} while( false )
#elif __CUDA_ARCH__
}while( false )
#elif __CUDA_ARCH__
#define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
do \
{ \
Expand Down Expand Up @@ -230,44 +218,35 @@
* - Mandatory first parameter, the type of the exception to throw
* - Optional following parameters, context information on the current error (DataContext)
*/
#if !defined(GEOS_DEVICE_COMPILE)
#if !defined(GEOS_DEVICE_COMPILE)
#define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
do \
{ \
if( COND ) \
{ \
std::ostringstream __msgoss; \
__msgoss << MSG; \
std::string __message = __msgoss.str(); \
__msgoss = std::ostringstream(); \
__msgoss << CAUSE_MESSAGE; \
std::string __cause = __msgoss.str(); \
std::ostringstream __oss; \
__oss << "***** EXCEPTION\n"; \
__oss << "***** LOCATION: " LOCATION "\n"; \
__oss << "***** " << __cause << "\n"; \
__oss << "***** Rank " << ::geos::logger::internal::g_rankString << ": " << __message << "\n"; \
std::string stackHistory = LvArray::system::stackTrace( true ); \
__oss << stackHistory; \
if( GEOS_ERROR_LOGGER_INSTANCE.isOutputFileEnabled() ) \
{ \
if( GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg().m_type == ErrorLogger::MsgType::Undefined ) \
{ /* first throw site, we initialize the error message completly */ \
GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg() \
.setType( ErrorLogger::MsgType::Exception ) \
.setCodeLocation( __FILE__, __LINE__ ) \
.setCause( __cause ) \
.addRank( ::geos::logger::internal::g_rank ) \
.addCallStackInfo( stackHistory ); \
} \
std::ostringstream flushoss; \
std::ostringstream msgoss; \
msgoss << MSG; \
std::ostringstream causemsgsoss; \
causemsgsoss << CAUSE_MESSAGE; \
if( GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg().m_type == ErrorLogger::MsgType::Undefined ) \
{ /* first throw site, we initialize the error message completly */ \
GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg() \
.addToMsg( __message ) \
.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
.setType( ErrorLogger::MsgType::Exception ) \
.setCodeLocation( __FILE__, __LINE__ ) \
.setCause( causemsgsoss.str() ) \
.addRank( ::geos::logger::internal::g_rank ) \
.addCallStackInfo( LvArray::system::stackTrace( true ) ); \
} \
throw GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ )( __oss.str() ); \
GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg() \
.addToMsg( msgoss.str() ) \
.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
ErrorLogger::formatMsgToAscii( GEOS_ERROR_LOGGER_INSTANCE.currentErrorMsg(), \
::geos::logger::internal::g_rankString, flushoss ); \
throw GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ )( flushoss.str()); \
} \
} while( false )
#elif __CUDA_ARCH__
#elif __CUDA_ARCH__
#define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
do \
{ \
Expand Down Expand Up @@ -319,29 +298,19 @@
{ \
if( COND ) \
{ \
std::ostringstream __msgoss; \
__msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
std::string __message = __msgoss.str(); \
__msgoss = std::ostringstream(); \
__msgoss << CAUSE_MESSAGE; \
std::string __cause = __msgoss.str(); \
std::ostringstream __oss; \
__oss << "***** WARNING\n"; \
__oss << "***** LOCATION: " LOCATION "\n"; \
__oss << "***** " << __cause << "\n"; \
__oss << "***** Rank " << ::geos::logger::internal::g_rankString << ": " << __message << "\n"; \
std::cout << __oss.str() << std::endl; \
if( GEOS_ERROR_LOGGER_INSTANCE.isOutputFileEnabled() ) \
{ \
ErrorLogger::ErrorMsg msgStruct( ErrorLogger::MsgType::Warning, \
__message, \
::geos::logger::internal::g_rank, \
__FILE__, \
__LINE__ ); \
msgStruct.setCause( __cause ); \
msgStruct.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
GEOS_ERROR_LOGGER_INSTANCE.flushErrorMsg( msgStruct ); \
} \
std::ostringstream flushoss; \
std::ostringstream msgoss; \
msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
std::ostringstream causemsgsoss; \
causemsgsoss << CAUSE_MESSAGE; \
ErrorLogger::ErrorMsg msgStruct( ErrorLogger::MsgType::Warning, \
msgoss.str(), \
::geos::logger::internal::g_rank, \
__FILE__, \
__LINE__ ); \
msgStruct.setCause( causemsgsoss.str() ); \
msgStruct.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
GEOS_ERROR_LOGGER_INSTANCE.flushErrorMsg( msgStruct, flushoss ); \
} \
} while( false )
#elif __CUDA_ARCH__
Expand Down Expand Up @@ -1043,7 +1012,7 @@ extern std::string g_rankString;

extern std::ostream * g_rankStream;

} // namespace internal
} // namespace internal

#if defined(GEOS_USE_MPI)
/**
Expand All @@ -1065,8 +1034,9 @@ void InitializeLogger( const std::string & rank_output_dir="" );
*/
void FinalizeLogger();

} // namespace logger
} // namespace logger


} // namespace geos
} // namespace geos

#endif /* GEOS_COMMON_LOGGER_HPP */
Loading
Loading