Changeset 87:787366e348d5 in rrlib_logging


Ignore:
Timestamp:
20.02.2012 18:25:05 (9 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Transplant:
a589dae0360bf5d169230fac31d2afeee37147bd
Message:

Fixed pass-by-value bug for exceptions

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • messages/implementation.h

    r78 r87  
    7777{ 
    7878template <typename THead> 
    79 void SendDataToStream(tStream &stream, THead head) 
     79void SendDataToStream(tStream &stream, const THead &head) 
    8080{ 
    8181  stream << head; 
     
    8383 
    8484template <typename THead, typename ... TTail> 
    85 void SendDataToStream(tStream &stream, THead head, TTail ... tail) 
     85void SendDataToStream(tStream &stream, const THead &head, const TTail &... tail) 
    8686{ 
    8787  stream << head; 
     
    9393 
    9494template <typename TLogDescription, typename ... TArgs> 
    95 void Print(const tConfiguration &domain_configuration, const TLogDescription &log_description, const char *function, const char *filename, unsigned int line, tLogLevel level, TArgs ... args) 
     95void Print(const tConfiguration &domain_configuration, const TLogDescription &log_description, const char *function, const char *filename, unsigned int line, tLogLevel level, const TArgs &... args) 
    9696{ 
    9797  if (level > domain_configuration.MaxMessageLevel()) 
  • messages/tStream.h

    r85 r87  
    163163   * \returns A reference to the altered stream (in this case the proxy) 
    164164   */ 
     165  inline tStream &operator << (const std::exception &exception) 
     166  { 
     167    this->stream << "Exception (" << typeid(exception).name() << "): " << exception.what(); 
     168    return *this; 
     169  } 
    165170  inline tStream &operator << (std::exception &exception) 
    166171  { 
  • test/test_messages.cpp

    r79 r87  
    145145  local::Test::function(); 
    146146 
    147   RRLIB_LOG_PRINT(rrlib::logging::eLL_ERROR, std::runtime_error("runtime_error")); 
     147  std::runtime_error exception("runtime_error"); 
     148  std::exception &e(exception); 
     149  RRLIB_LOG_PRINT(rrlib::logging::eLL_ERROR, e); 
    148150 
    149151  RRLIB_LOG_PRINT(rrlib::logging::eLL_WARNING, "0x", std::setw(20), std::setfill('0'), std::hex, 324); 
Note: See TracChangeset for help on using the changeset viewer.