Changeset 56:acb6737b3d1b in rrlib_logging


Ignore:
Timestamp:
31.05.2011 16:31:22 (9 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Convert:
svn:2179b62a-598e-4714-ba03-d8986cbf34aa/trunk@64
Message:

Added RRLIB_LOG_MESSAGE_STATIC and RRLIB_LOG_STREAM_STATIC to log from static contexts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • definitions.h

    r55 r56  
    114114  ((level) <= RRLIB_LOG_GET_DOMAIN(args)->GetMaxMessageLevel() ? RRLIB_LOG_GET_DOMAIN(args)->GetMessageStream(GetLogDescription(), __FUNCTION__, __FILE__, __LINE__, level).Evaluate(args) : RRLIB_LOG_GET_DOMAIN(args)->GetMessageStream(GetLogDescription(), __FUNCTION__, __FILE__, __LINE__, level)) \ 
    115115    
     116#define RRLIB_LOG_STREAM_CALL_STATIC(level, args...) \ 
     117  ((level) <= RRLIB_LOG_GET_DOMAIN(args)->GetMaxMessageLevel() ? RRLIB_LOG_GET_DOMAIN(args)->GetMessageStream("<static>", __FUNCTION__, __FILE__, __LINE__, level).Evaluate(args) : RRLIB_LOG_GET_DOMAIN(args)->GetMessageStream(GetLogDescription(), __FUNCTION__, __FILE__, __LINE__, level)) \ 
     118    
    116119#define RRLIB_LOG_MESSAGE_CALL(level, args...) \ 
    117120  do \ 
     
    120123    { \ 
    121124      RRLIB_LOG_GET_DOMAIN(args)->PrintMessage(GetLogDescription(), __FUNCTION__, __FILE__, __LINE__, level, args); \ 
     125    } \ 
     126  } while (0) \ 
     127      
     128#define RRLIB_LOG_MESSAGE_CALL_STATIC(level, args...) \ 
     129  do \ 
     130  { \ 
     131    if ((level) <= RRLIB_LOG_GET_DOMAIN(args)->GetMaxMessageLevel()) \ 
     132    { \ 
     133      RRLIB_LOG_GET_DOMAIN(args)->PrintMessage("<static>", __FUNCTION__, __FILE__, __LINE__, level, args); \ 
    122134    } \ 
    123135  } while (0) \ 
     
    138150  RRLIB_LOG_STREAM_CALL(level, args) \ 
    139151    
     152/*! Macro to get a stream for messages using operator << from static context 
     153 * 
     154 * \param level    The level of the message 
     155 * \param domain   The domain the message should be processed in 
     156 * 
     157 * \returns The stream for message output 
     158 */ 
     159#define RRLIB_LOG_STREAM_STATIC(level, args...) \ 
     160  RRLIB_LOG_STREAM_CALL_STATIC(level, args) \ 
     161    
    140162/*! Macro for messages using printf syntax 
    141163 * 
     
    150172    { \ 
    151173      RRLIB_LOG_MESSAGE_CALL(level, args); \ 
     174    } \ 
     175  } while (0) \ 
     176      
     177/*! Macro for messages using printf syntax from static context 
     178 * 
     179 * \param level    The level of the message 
     180 * \param domain   The domain the message should be processed in 
     181 * \param args     The format string for printf and the optional arguments to be printed. 
     182 */ 
     183#define RRLIB_LOG_MESSAGE_STATIC(level, args...) \ 
     184  do \ 
     185  { \ 
     186    if ((level) <= rrlib::logging::eLL_DEBUG) \ 
     187    { \ 
     188      RRLIB_LOG_MESSAGE_CALL_STATIC(level, args); \ 
    152189    } \ 
    153190  } while (0) \ 
     
    165202  RRLIB_LOG_STREAM_CALL(level, args) \ 
    166203    
     204/*! Macro to get a stream for messages using operator << from static context 
     205 * 
     206 * \param level    The level of the message 
     207 * \param domain   The domain the message should be processed in 
     208 * 
     209 * \returns The stream for message output 
     210 */ 
     211#define RRLIB_LOG_STREAM_STATIC(level, args...) \ 
     212  RRLIB_LOG_STREAM_CALL_STATIC(level, args) \ 
     213    
    167214/*! Macro for messages using printf syntax 
    168215 * 
     
    173220#define RRLIB_LOG_MESSAGE(level, args...) \ 
    174221  RRLIB_LOG_MESSAGE_CALL(level, args) \ 
     222    
     223/*! Macro for messages using printf syntax from static context 
     224 * 
     225 * \param level    The level of the message 
     226 * \param domain   The domain the message should be processed in 
     227 * \param args     The format string for printf and the optional arguments to be printed. 
     228 */ 
     229#define RRLIB_LOG_MESSAGE_STATIC(level, args...) \ 
     230  RRLIB_LOG_MESSAGE_CALL_STATIC(level, args) \ 
    175231    
    176232#endif 
Note: See TracChangeset for help on using the changeset viewer.