Changeset 103:b2191850c420 in rrlib_logging


Ignore:
Timestamp:
10.07.2013 13:39:46 (7 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Added RRLIB_LOG_THROW macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • messages.h

    r101 r103  
    296296#endif 
    297297 
    298  
     298/*! Macro to throw and log exceptions in one line 
     299 * 
     300 * \param exception   The exception to be thrown 
     301 */ 
     302#define RRLIB_LOG_THROW(exception) \ 
     303  do \ 
     304  { \ 
     305    RRLIB_LOG_PRINT(ERROR, exception); \ 
     306    throw exception; \ 
     307  } while (0) \ 
     308      
     309/*! Macro to throw and log exceptions to explicitly specified domain in one line 
     310 * 
     311 * \param domain      The domain the message should be printed to 
     312 * \param exception   The exception to be thrown 
     313 */ 
     314#define RRLIB_LOG_THROW_TO(domain, exception) \ 
     315  do \ 
     316  { \ 
     317    RRLIB_LOG_PRINT_TO(domain, ERROR, exception); \ 
     318    throw exception; \ 
     319  } while (0) \ 
     320      
     321/*! Macro to throw and log exceptions in one line from static context 
     322 * 
     323 * \param exception   The exception to be thrown 
     324 */ 
     325#define RRLIB_LOG_THROW_STATIC(exception) \ 
     326  do \ 
     327  { \ 
     328    RRLIB_LOG_PRINT_STATIC(ERROR, exception); \ 
     329    throw exception; \ 
     330  } while (0) \ 
     331      
     332/*! Macro to throw and log exceptions to explicitly specified domain in one line from static context 
     333 * 
     334 * \param domain      The domain the message should be printed to 
     335 * \param exception   The exception to be thrown 
     336 */ 
     337#define RRLIB_LOG_THROW_STATIC_TO(domain, exception) \ 
     338  do \ 
     339  { \ 
     340    RRLIB_LOG_PRINT_STATIC_TO(domain, ERROR, exception); \ 
     341    throw exception; \ 
     342  } while (0) \ 
     343      
    299344 
    300345// The default global GetLogDescription definition 
Note: See TracChangeset for help on using the changeset viewer.