Changeset 79:42b258bd365c in rrlib_logging


Ignore:
Timestamp:
15.01.2012 01:10:52 (9 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Transplant:
7b6dbcf716a1cb5d8cbe2662d2bc8bb3985c4224
Message:

Added support for null-characters

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • configuration.h

    r78 r79  
    6262//---------------------------------------------------------------------- 
    6363 
    64 const char *GetLogDescription() 
    65 { 
    66   return "RRLib Logging"; 
    67 } 
    68  
    6964void SetLogFilenamePrefix(const std::string &filename_prefix); 
    7065 
  • messages/tStream.h

    r71 r79  
    181181  { 
    182182    this->stream << (value ? "<true>" : "<false>"); 
     183    return *this; 
     184  } 
     185 
     186  /*! Streaming operator for bool values 
     187   * 
     188   * This method implements more appropriate log streaming for bool values, 
     189   * printing "<true>" and "<false>" instead of 1 and 0. 
     190   * 
     191   * \param value   The bool value to put into the stream 
     192   * 
     193   * \returns A reference to the altered stream (in this case the proxy) 
     194   */ 
     195  inline tStream &operator << (char value) 
     196  { 
     197    if (value == 0) 
     198    { 
     199      this->stream << "<null>"; 
     200      return *this; 
     201    } 
     202    this->stream << value; 
    183203    return *this; 
    184204  } 
  • test/test_messages.cpp

    r77 r79  
    165165  RRLIB_LOG_PRINT(rrlib::logging::eLL_DEBUG, "Bool: ", true, false); 
    166166  RRLIB_LOG_PRINT(rrlib::logging::eLL_DEBUG, "Function: ", main); 
     167  RRLIB_LOG_PRINT(rrlib::logging::eLL_DEBUG, "Mal noch einzelne Zeichen: ", 'a', '\0', 'b'); 
    167168 
    168169  rrlib::logging::PrintDomainConfigurations(); 
Note: See TracChangeset for help on using the changeset viewer.