GEOS
Logger.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_COMMON_LOGGER_HPP
21 #define GEOS_COMMON_LOGGER_HPP
22 
23 // Source includes
24 #include "LvArray/src/Macros.hpp"
26 
27 // System includes
28 #include <stdexcept>
29 
30 #if defined(GEOS_USE_MPI)
31  #include <mpi.h>
32 #endif
33 
38 #define GEOS_LOG( ... ) LVARRAY_LOG( __VA_ARGS__ )
39 
44 #define GEOS_LOG_VAR( ... ) LVARRAY_LOG_VAR( __VA_ARGS__ )
45 
46 
52 #if defined(GEOS_DEVICE_COMPILE)
53 #define GEOS_LOG_IF( EXP, msg )
54 #else
55 #define GEOS_LOG_IF( EXP, msg ) \
56  do { \
57  if( EXP ) \
58  { \
59  std::cout<< msg << std::endl; \
60  } \
61  } while( false )
62 #endif
63 
64 
70 #define GEOS_LOG_RANK_0_IF( EXP, msg ) \
71  do { \
72  if( ::geos::logger::internal::g_rank == 0 && EXP ) \
73  { \
74  std::ostringstream oss; \
75  oss << msg; \
76  std::cout << oss.str() << std::endl; \
77  } \
78  } while( false )
79 
85 #define GEOS_LOG_RANK_0_IF_NLR( EXP, msg ) \
86  do { \
87  if( ::geos::logger::internal::g_rank == 0 && EXP ) \
88  { \
89  std::ostringstream oss; \
90  oss << msg; \
91  std::cout << oss.str(); \
92  } \
93  } while( false )
94 
99 #define GEOS_LOG_RANK_0( msg ) GEOS_LOG_RANK_0_IF( true, msg )
100 
106 #if defined(GEOS_DEVICE_COMPILE)
107 #define GEOS_LOG_RANK_IF( EXP, msg )
108 #else
109 #define GEOS_LOG_RANK_IF( EXP, msg ) \
110  do { \
111  if( EXP ) \
112  { \
113  std::ostringstream oss; \
114  oss << "Rank " << ::geos::logger::internal::g_rankString << ": " << msg; \
115  *logger::internal::g_rankStream << oss.str() << std::endl; \
116  } \
117  } while( false )
118 #endif
119 
124 #define GEOS_LOG_RANK( msg ) GEOS_LOG_RANK_IF( true, msg )
125 
130 #define GEOS_LOG_RANK_VAR( var ) GEOS_LOG_RANK( #var " = " << var )
131 
137 #if !defined(GEOS_DEVICE_COMPILE) && !defined(GEOS_GLOBAL_LOGGER)
138 #define GEOS_GLOBAL_LOGGER ErrorLogger::global()
139 #endif
140 
150 #if !defined(GEOS_DEVICE_COMPILE)
151 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
152  do \
153  { \
154  if( COND ) \
155  { \
156  std::ostringstream __msgoss; \
157  __msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
158  std::ostringstream __causemsgsoss; \
159  __causemsgsoss << CAUSE_MESSAGE; \
160  GEOS_GLOBAL_LOGGER.initCurrentExceptionMessage( MsgType::Error, __msgoss.str(), \
161  ::geos::logger::internal::g_rank ) \
162  .setCodeLocation( __FILE__, __LINE__ ) \
163  .setCause( __causemsgsoss.str() ) \
164  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
165  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )); \
166  GEOS_GLOBAL_LOGGER.flushCurrentExceptionMessage(); \
167  LvArray::system::callErrorHandler(); \
168  } \
169  }while( false )
170  #elif __CUDA_ARCH__
171 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
172  do \
173  { \
174  if( COND ) \
175  { \
176  constexpr char const * formatString = "***** ERROR\n" \
177  "***** LOCATION" LOCATION "\n" \
178  "***** BLOCK: [%u, %u, %u]\n" \
179  "***** THREAD: [%u, %u, %u]\n" \
180  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
181  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
182  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
183  asm ( "trap;" ); \
184  } \
185  } while( false )
186 #elif __HIP_DEVICE_COMPILE__
187 #define GEOS_ERROR_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
188  do \
189  { \
190  if( COND ) \
191  { \
192  GEOS_UNUSED_VAR( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ); \
193  constexpr char const * formatString = "***** ERROR\n" \
194  "***** LOCATION" LOCATION "\n" \
195  "***** BLOCK: [%u, %u, %u]\n" \
196  "***** THREAD: [%u, %u, %u]\n" \
197  "***** %s\n" \
198  "***** %s\n\n"; \
199  printf( formatString, \
200  blockIdx.x, blockIdx.y, blockIdx.z, \
201  threadIdx.x, threadIdx.y, threadIdx.z, \
202  STRINGIZE( CAUSE_MESSAGE ), \
203  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
204  ); \
205  asm volatile ( "s_trap 2" ); \
206  } \
207  } while( false )
208 #endif
209 
217 #define GEOS_ERROR_IF( COND, ... ) \
218  GEOS_ERROR_IF_CAUSE( COND, "Error cause: " STRINGIZE( COND ), __VA_ARGS__ )
219 
226 #define GEOS_ERROR( ... ) GEOS_ERROR_IF_CAUSE( true, "", __VA_ARGS__ )
227 
237 #if !defined(GEOS_DEVICE_COMPILE)
238 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
239  do \
240  { \
241  if( COND ) \
242  { \
243  std::ostringstream __msgoss; \
244  __msgoss << MSG; \
245  std::ostringstream __causemsgsoss; \
246  __causemsgsoss << CAUSE_MESSAGE; \
247  DiagnosticMsg exceptionMsg = GEOS_GLOBAL_LOGGER.initCurrentExceptionMessage( MsgType::Exception, __msgoss.str(), \
248  ::geos::logger::internal::g_rank ) \
249  .setCodeLocation( __FILE__, __LINE__ ) \
250  .setCause( __causemsgsoss.str() ) \
251  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
252  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )) \
253  .getDiagnosticMsg(); \
254  auto ex = GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ )(); \
255  ex.prepareWhat( exceptionMsg ); \
256  throw ex; \
257  } \
258  }while( false )
259 #elif __CUDA_ARCH__
260 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
261  do \
262  { \
263  if( COND ) \
264  { \
265  static char const formatString[] = "***** ERROR\n" \
266  "***** LOCATION" LOCATION "\n" \
267  "***** BLOCK: [%u, %u, %u]\n" \
268  "***** THREAD: [%u, %u, %u]\n" \
269  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
270  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
271  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
272  asm ( "trap;" ); \
273  } \
274  } while( false )
275 #elif __HIP_DEVICE_COMPILE__
276 #define GEOS_THROW_IF_CAUSE( COND, CAUSE_MESSAGE, MSG, ... ) \
277  do \
278  { \
279  if( COND ) \
280  { \
281  ::geos::internal::DeviceNullStream __geosNullStream; \
282  __geosNullStream << MSG; \
283  static char const formatString[] = "***** ERROR\n" \
284  "***** LOCATION" LOCATION "\n" \
285  "***** BLOCK: [%u, %u, %u]\n" \
286  "***** THREAD: [%u, %u, %u]\n" \
287  "***** %s\n" \
288  "***** %s\n\n"; \
289  printf( formatString, \
290  blockIdx.x, blockIdx.y, blockIdx.z, \
291  threadIdx.x, threadIdx.y, threadIdx.z, \
292  STRINGIZE( CAUSE_MESSAGE ), \
293  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
294  ); \
295  asm volatile ( "s_trap 2" ); \
296  } \
297  } while( false )
298 #endif
299 
308 #define GEOS_THROW_IF( COND, MSG, ... ) \
309  GEOS_THROW_IF_CAUSE( COND, "Error cause: " STRINGIZE( COND ), MSG, __VA_ARGS__ )
310 
318 #define GEOS_THROW( MSG, ... ) GEOS_THROW_IF_CAUSE( true, "", MSG, __VA_ARGS__ )
319 
328 #if !defined(GEOS_DEVICE_COMPILE)
329 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
330  do \
331  { \
332  if( COND ) \
333  { \
334  std::ostringstream __msgoss; \
335  __msgoss << GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ); \
336  std::ostringstream __causemsgsoss; \
337  __causemsgsoss << CAUSE_MESSAGE; \
338  DiagnosticMsg __warningMsg; \
339  GEOS_GLOBAL_LOGGER.flushErrorMsg( DiagnosticMsgBuilder::init( __warningMsg, \
340  MsgType::Warning, __msgoss.str(), \
341  ::geos::logger::internal::g_rank ) \
342  .setCodeLocation( __FILE__, __LINE__ ) \
343  .setCause( __causemsgsoss.str() ) \
344  .addCallStackInfo( LvArray::system::stackTrace( true ) ) \
345  .addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ )) \
346  .getDiagnosticMsg() ); \
347  } \
348  }while( false )
349 #elif __CUDA_ARCH__
350 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
351  do \
352  { \
353  if( COND ) \
354  { \
355  static char const formatString[] = "***** WARNING\n" \
356  "***** LOCATION" LOCATION "\n" \
357  "***** BLOCK: [%u, %u, %u]\n" \
358  "***** THREAD: [%u, %u, %u]\n" \
359  "***** " STRINGIZE( CAUSE_MESSAGE ) "\n" \
360  "***** " STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) "\n\n"; \
361  printf( formatString, blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, threadIdx.z ); \
362  asm ( "trap;" ); \
363  } \
364  } while( false )
365 #elif __HIP_DEVICE_COMPILE__
366 #define GEOS_WARNING_IF_CAUSE( COND, CAUSE_MESSAGE, ... ) \
367  do \
368  { \
369  if( COND ) \
370  { \
371  static char const formatString[] = "***** WARNING\n" \
372  "***** LOCATION" LOCATION "\n" \
373  "***** BLOCK: [%u, %u, %u]\n" \
374  "***** THREAD: [%u, %u, %u]\n" \
375  "***** %s\n" \
376  "***** %s\n\n"; \
377  printf( formatString, \
378  blockIdx.x, blockIdx.y, blockIdx.z, \
379  threadIdx.x, threadIdx.y, threadIdx.z, \
380  STRINGIZE( CAUSE_MESSAGE ), \
381  STRINGIZE( GEOS_DETAIL_FIRST_ARG( __VA_ARGS__ ) ) \
382  ); \
383  asm volatile ( "s_trap 2" ); \
384  } \
385  } while( false )
386 #endif
387 
395 #define GEOS_WARNING_IF( COND, ... ) \
396  GEOS_WARNING_IF_CAUSE( COND, "Warning cause: " STRINGIZE( COND ), __VA_ARGS__ )
397 
404 #define GEOS_WARNING( ... ) GEOS_WARNING_IF_CAUSE( true, "", __VA_ARGS__ )
405 
411 #define GEOS_INFO_IF( EXP, msg ) LVARRAY_INFO_IF( EXP, msg )
412 
417 #define GEOS_INFO( msg ) LVARRAY_INFO( msg )
418 
424 #define GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ) \
425  GEOS_MAYBE_UNUSED auto const lhsResult = (lhs); \
426  GEOS_MAYBE_UNUSED auto const rhsResult = (rhs)
427 
438 #define GEOS_ERROR_IF_OP_MSG( lhs, OP, NOP, rhs, ... ) \
439  do { \
440  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
441  GEOS_ERROR_IF_CAUSE( lhsResult OP rhsResult, \
442  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
443  __VA_ARGS__ ); \
444  } while(false)
445 
446 
455 #define GEOS_ERROR_IF_EQ_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, ==, !=, rhs, __VA_ARGS__ )
456 
462 #define GEOS_ERROR_IF_EQ( lhs, rhs ) GEOS_ERROR_IF_EQ_MSG( lhs, rhs, "" )
463 
472 #define GEOS_ERROR_IF_NE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, !=, ==, rhs, __VA_ARGS__ )
473 
479 #define GEOS_ERROR_IF_NE( lhs, rhs ) GEOS_ERROR_IF_NE_MSG( lhs, rhs, "" )
480 
489 #define GEOS_ERROR_IF_GT_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, >, <=, rhs, __VA_ARGS__ )
490 
496 #define GEOS_ERROR_IF_GT( lhs, rhs ) GEOS_ERROR_IF_GT_MSG( lhs, rhs, "" )
497 
506 #define GEOS_ERROR_IF_GE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, >=, <, rhs, __VA_ARGS__ )
507 
513 #define GEOS_ERROR_IF_GE( lhs, rhs ) GEOS_ERROR_IF_GE_MSG( lhs, rhs, "" )
514 
523 #define GEOS_ERROR_IF_LT_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, <, >=, rhs, __VA_ARGS__ )
524 
530 #define GEOS_ERROR_IF_LT( lhs, rhs ) GEOS_ERROR_IF_LT_MSG( lhs, rhs, "" )
531 
540 #define GEOS_ERROR_IF_LE_MSG( lhs, rhs, ... ) GEOS_ERROR_IF_OP_MSG( lhs, <=, >, rhs, __VA_ARGS__ )
541 
542 
548 #define GEOS_ERROR_IF_LE( lhs, rhs ) GEOS_ERROR_IF_LE_MSG( lhs, rhs, "" )
549 
560 #define GEOS_WARNING_IF_OP_MSG( lhs, OP, NOP, rhs, ... ) \
561  do { \
562  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
563  GEOS_WARNING_IF_CAUSE( lhsResult OP rhsResult, \
564  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
565  __VA_ARGS__ ); \
566  } while(false)
567 
568 
577 #define GEOS_WARNING_IF_EQ_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, ==, !=, rhs, __VA_ARGS__ )
578 
584 #define GEOS_WARNING_IF_EQ( lhs, rhs ) GEOS_WARNING_IF_EQ_MSG( lhs, rhs, "" )
585 
594 #define GEOS_WARNING_IF_NE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, !=, ==, rhs, __VA_ARGS__ )
595 
601 #define GEOS_WARNING_IF_NE( lhs, rhs ) GEOS_WARNING_IF_NE_MSG( lhs, rhs, "" )
602 
611 #define GEOS_WARNING_IF_GT_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, >, <=, rhs, __VA_ARGS__ )
612 
618 #define GEOS_WARNING_IF_GT( lhs, rhs ) GEOS_WARNING_IF_GT_MSG( lhs, rhs, "" )
619 
628 #define GEOS_WARNING_IF_GE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, >=, <, rhs, __VA_ARGS__ )
629 
635 #define GEOS_WARNING_IF_GE( lhs, rhs ) GEOS_WARNING_IF_GE_MSG( lhs, rhs, "" )
636 
645 #define GEOS_WARNING_IF_LT_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, <, >=, rhs, __VA_ARGS__ )
646 
652 #define GEOS_WARNING_IF_LT( lhs, rhs ) GEOS_WARNING_IF_LT_MSG( lhs, rhs, "" )
653 
662 #define GEOS_WARNING_IF_LE_MSG( lhs, rhs, ... ) GEOS_WARNING_IF_OP_MSG( lhs, <=, >, rhs, __VA_ARGS__ )
663 
669 #define GEOS_WARNING_IF_LE( lhs, rhs ) GEOS_WARNING_IF_LE_MSG( lhs, rhs, "" )
670 
682 #define GEOS_THROW_IF_OP_MSG( lhs, OP, NOP, rhs, MSG, ... ) \
683  do { \
684  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
685  GEOS_THROW_IF_CAUSE( lhsResult OP rhsResult, \
686  "Expected: " #lhs " " #NOP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
687  MSG, __VA_ARGS__ ); \
688  } while(false)
689 
690 
691 
701 #define GEOS_THROW_IF_EQ_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, ==, !=, rhs, MSG, __VA_ARGS__ )
702 
711 #define GEOS_THROW_IF_EQ( lhs, rhs, ... ) GEOS_THROW_IF_EQ_MSG( lhs, rhs, "", __VA_ARGS__ )
712 
722 #define GEOS_THROW_IF_NE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, !=, ==, rhs, MSG, __VA_ARGS__ )
723 
732 #define GEOS_THROW_IF_NE( lhs, rhs, ... ) GEOS_THROW_IF_NE_MSG( lhs, rhs, "", __VA_ARGS__ )
733 
743 #define GEOS_THROW_IF_GT_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, >, <=, rhs, MSG, __VA_ARGS__ )
744 
753 #define GEOS_THROW_IF_GT( lhs, rhs, ... ) GEOS_THROW_IF_GT_MSG( lhs, rhs, "", __VA_ARGS__ )
754 
764 #define GEOS_THROW_IF_GE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, >=, <, rhs, MSG, __VA_ARGS__ )
765 
774 #define GEOS_THROW_IF_GE( lhs, rhs, ... ) GEOS_THROW_IF_GE_MSG( lhs, rhs, "", __VA_ARGS__ )
775 
785 #define GEOS_THROW_IF_LT_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, <, >=, rhs, MSG, __VA_ARGS__ )
786 
795 #define GEOS_THROW_IF_LT( lhs, rhs, ... ) GEOS_THROW_IF_LT_MSG( lhs, rhs, "", __VA_ARGS__ )
796 
806 #define GEOS_THROW_IF_LE_MSG( lhs, rhs, MSG, ... ) GEOS_THROW_IF_OP_MSG( lhs, <=, >, rhs, MSG, __VA_ARGS__ )
807 
816 #define GEOS_THROW_IF_LE( lhs, rhs, ... ) GEOS_THROW_IF_LE_MSG( lhs, rhs, "", __VA_ARGS__ )
817 
818 #if !defined(NDEBUG) || defined(GEOS_ASSERT_ENABLED)
819 
823 #define GEOS_ASSERT_ENABLED
824 
837 #define GEOS_ASSERT_MSG( COND, ... ) \
838  GEOS_ERROR_IF_CAUSE( !( COND ), "Expected: " STRINGIZE( COND ), __VA_ARGS__ )
839 
849 #define GEOS_ASSERT_OP_MSG( lhs, OP, rhs, ... ) \
850  { \
851  GEOS_ERROR_LHS_RHS_DECLS( lhs, rhs ); \
852  GEOS_ERROR_IF_CAUSE( !( lhsResult OP rhsResult ), \
853  "Expected: " #lhs " " #OP " " #rhs "\n* " #lhs " = " << lhsResult << "\n* " #rhs " = " << rhsResult << "\n", \
854  __VA_ARGS__ ); \
855  }
856 
857 #else
858 
859 #define GEOS_ASSERT_MSG( ... ) ((void) 0)
860 #define GEOS_ASSERT_OP_MSG( ... ) ((void) 0)
861 
862 #endif
863 
868 #define GEOS_ASSERT( COND ) GEOS_ASSERT_MSG( COND, "" )
869 
878 #define GEOS_ASSERT_EQ_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, ==, rhs, __VA_ARGS__ )
879 
885 #define GEOS_ASSERT_EQ( lhs, rhs ) GEOS_ASSERT_EQ_MSG( lhs, rhs, "" )
886 
895 #define GEOS_ASSERT_NE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, !=, rhs, __VA_ARGS__ )
896 
902 #define GEOS_ASSERT_NE( lhs, rhs ) GEOS_ASSERT_NE_MSG( lhs, rhs, "" )
903 
912 #define GEOS_ASSERT_GT_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, >, rhs, __VA_ARGS__ )
913 
919 #define GEOS_ASSERT_GT( lhs, rhs ) GEOS_ASSERT_GT_MSG( lhs, rhs, "" )
920 
929 #define GEOS_ASSERT_GE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, >=, rhs, __VA_ARGS__ )
930 
936 #define GEOS_ASSERT_GE( lhs, rhs ) GEOS_ASSERT_GE_MSG( lhs, rhs, "" )
937 
946 #define GEOS_ASSERT_LT_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, <, rhs, __VA_ARGS__ )
947 
953 #define GEOS_ASSERT_LT( lhs, rhs ) GEOS_ASSERT_LT_MSG( lhs, rhs, "" )
954 
963 #define GEOS_ASSERT_LE_MSG( lhs, rhs, ... ) GEOS_ASSERT_OP_MSG( lhs, <=, rhs, __VA_ARGS__ )
964 
970 #define GEOS_ASSERT_LE( lhs, rhs ) GEOS_ASSERT_LE_MSG( lhs, rhs, "" )
971 
972 namespace geos
973 {
974 
975 namespace logger
976 {
977 
978 namespace internal
979 {
980 
981 extern int g_rank;
982 
983 extern std::string g_rankString;
984 
985 extern std::ostream * g_rankStream;
986 
987 } // namespace internal
988 
989 #if defined(GEOS_USE_MPI)
995 void InitializeLogger( MPI_Comm comm, const std::string & rank_output_dir="" );
996 #endif
997 
1002 void InitializeLogger( const std::string & rank_output_dir="" );
1003 
1008 
1009 } // namespace logger
1010 
1011 } // namespace geos
1012 
1013 #endif /* GEOS_COMMON_LOGGER_HPP */
void FinalizeLogger()
Finalize the logger and close the rank streams.
void InitializeLogger(const std::string &rank_output_dir="")
Initialize the logger in a serial build.
std::string string
String type.
Definition: DataTypes.hpp:90