Changeset 62:f10cc7dd37ca in rrlib_logging


Ignore:
Timestamp:
23.08.2011 17:33:13 (9 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Adapted test program

Location:
test
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • test/debugging.h

    r51 r62  
    4646#include "rrlib/logging/definitions.h" 
    4747 
    48 #define DEBUGMSG(args...)   RRLIB_LOG_MESSAGE(rrlib::logging::eLL_DEBUG_VERBOSE_1, args) 
    49 #define INFOMSG(args...)    RRLIB_LOG_MESSAGE(rrlib::logging::eLL_DEBUG, args) 
    50 #define WARNINGMSG(args...) RRLIB_LOG_MESSAGE(rrlib::logging::eLL_WARNING, args) 
    51 #define ERRORMSG(args...)   RRLIB_LOG_MESSAGE(rrlib::logging::eLL_ERROR, args) 
    52 #define USERMSG(args...)    RRLIB_LOG_MESSAGE(rrlib::logging::eLL_USER, args) 
     48#define DEBUGMSG(args...)   RRLIB_LOG_PRINTF(rrlib::logging::eLL_DEBUG_VERBOSE_1, args) 
     49#define INFOMSG(args...)    RRLIB_LOG_PRINTF(rrlib::logging::eLL_DEBUG, args) 
     50#define WARNINGMSG(args...) RRLIB_LOG_PRINTF(rrlib::logging::eLL_WARNING, args) 
     51#define ERRORMSG(args...)   RRLIB_LOG_PRINTF(rrlib::logging::eLL_ERROR, args) 
     52#define USERMSG(args...)    RRLIB_LOG_PRINTF(rrlib::logging::eLL_USER, args) 
    5353 
    5454#endif 
  • test/libA/libA.h

    r51 r62  
    1010void Test() 
    1111{ 
    12   RRLIB_LOG_STREAM(rrlib::logging::eLL_DEBUG) << "Test in libA"; 
     12  RRLIB_LOG_PRINT(rrlib::logging::eLL_DEBUG, "Test in libA"); 
    1313} 
    1414} 
  • test/libB/libB.h

    r51 r62  
    1010void Test() 
    1111{ 
    12   RRLIB_LOG_STREAM(rrlib::logging::eLL_USER) << "Test in libB"; 
     12  RRLIB_LOG_PRINT(rrlib::logging::eLL_USER, "Test in libB"); 
    1313} 
    1414} 
  • test/test_messages.cpp

    r57 r62  
    4242} 
    4343 
     44#include "rrlib/util/stl_container/join.h" 
     45 
    4446//---------------------------------------------------------------------- 
    4547// Internal includes with "" 
     
    8183  static void function() 
    8284  { 
    83     RRLIB_LOG_STREAM(eLL_DEBUG_WARNING, my_domain, "this ", "is a ") << "local class test"; 
     85    RRLIB_LOG_PRINT(eLL_DEBUG_WARNING, my_domain, "this ", "is a ", "local class test"); 
    8486 
    85     RRLIB_LOG_STREAM(eLL_WARNING) << "foo" << std::endl; 
    86     RRLIB_LOG_STREAM(eLL_ERROR, my_domain) << "foo2" << std::endl; 
     87    RRLIB_LOG_PRINT(eLL_WARNING, "foo"); 
     88    RRLIB_LOG_PRINT(eLL_ERROR, my_domain, "foo2"); 
    8789    if (true) 
    8890    { 
    89       RRLIB_LOG_MESSAGE(eLL_DEBUG, my_domain, "%s\n", "FOO"); 
     91      RRLIB_LOG_PRINTF(eLL_DEBUG, my_domain, "%s\n", "FOO"); 
    9092    } 
    9193  } 
     
    103105  static void StaticMethod() 
    104106  { 
    105     RRLIB_LOG_STREAM_STATIC(eLL_USER, "From static method"); 
     107    RRLIB_LOG_PRINT_STATIC(eLL_USER, "From static method"); 
    106108  } 
    107109 
    108110  void NonStaticMethod() 
    109111  { 
    110     RRLIB_LOG_STREAM(eLL_USER, "From non-static method"); 
     112    RRLIB_LOG_PRINT(eLL_USER, "From non-static method"); 
    111113  } 
    112114}; 
     
    145147 
    146148 
    147   RRLIB_LOG_STREAM(eLL_WARNING) << "foo" << std::endl; 
     149  RRLIB_LOG_PRINT(eLL_WARNING, "foo"); 
    148150 
    149151  libA::Test(); 
     
    158160  USERMSG("blablabla User"); 
    159161 
    160   RRLIB_LOG_STREAM(eLL_ERROR) << std::runtime_error("runtime_error"); 
     162  RRLIB_LOG_PRINT(eLL_ERROR, std::runtime_error("runtime_error")); 
    161163 
    162   RRLIB_LOG_STREAM(eLL_WARNING) << std::hex << 324 << std::endl; 
     164  RRLIB_LOG_PRINT(eLL_WARNING, std::hex, 324); 
    163165 
    164   RRLIB_LOG_STREAM(eLL_ERROR) << "Das hier ist ein mehrzeiliger\nFehler."; 
    165   RRLIB_LOG_STREAM(eLL_USER) << "Und das hier ein mehrzeiliger\nText fuer den lieben Benutzer."; 
     166  RRLIB_LOG_PRINT(eLL_ERROR, "Das hier ist ein mehrzeiliger\nFehler."); 
     167  RRLIB_LOG_PRINT(eLL_USER, "Und das hier ein mehrzeiliger\nText fuer den lieben Benutzer."); 
    166168 
    167169  const char* texts[] = {"Dies", "ist", "ein", "kleiner", "Text."}; 
    168   std::copy(&texts[0], &texts[0] + 5, std::ostream_iterator<const char*>(RRLIB_LOG_STREAM(eLL_DEBUG), " ")); 
     170  //std::copy(&texts[0], &texts[0] + 5, std::ostream_iterator<const char*>(RRLIB_LOG_PRINT(eLL_DEBUG), " "));   that is not pretty. use the following line.... 
     171  RRLIB_LOG_PRINT(eLL_DEBUG, rrlib::util::Join(texts, texts + 5, " ")); 
    169172 
    170173  TestStatic test_static; 
Note: See TracChangeset for help on using the changeset viewer.