Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2007, 3:20:46 AM (16 years ago)
Author:
landauf
Message:
  • changed output from std::cout to COUT(level)
  • added SoftDebugLevel config-variable (its a hack, but it works fine)
Location:
code/branches/FICN/src/orxonox/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/CMakeLists.txt

    r555 r560  
    1111  SignalHandler.cc
    1212  ArgReader.cc
     13  DebugLevel.cc
    1314)
    1415
  • code/branches/FICN/src/orxonox/core/Debug.h

    r499 r560  
    2525
    2626#include <stdio.h>
     27
     28int getSoftDebugLevel();
    2729
    2830// DEFINE ERROR MODES
     
    3840
    3941#define ORX_HARD_DEBUG_LEVEL ORX_DEBUG
    40 #define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
     42//#define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
    4143
    4244///////////////////////////////////////////////////
     
    6163  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    6264   #define PRINTF1 \
    63     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR) \
     65    if (getSoftDebugLevel() >= ORX_ERROR) \
    6466     printf("Error (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    6567  #else
     
    6971  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    7072   #define PRINTF2 \
    71     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     73    if (getSoftDebugLevel() >= ORX_WARNING) \
    7274     printf("Warning (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    7375  #else
     
    7779  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    7880   #define PRINTF3 \
    79     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     81    if (getSoftDebugLevel() >= ORX_INFO) \
    8082     printf("Info (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    8183  #else
     
    8587  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    8688   #define PRINTF4 \
    87     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     89    if (getSoftDebugLevel() >= ORX_DEBUG) \
    8890     printf("Debug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    8991  #else
     
    9395  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    9496   #define PRINTF5 \
    95     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     97    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    9698     printf("vDebug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
    9799  #else
     
    124126  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    125127   #define PRINT1  \
    126     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR)  \
     128    if (getSoftDebugLevel() >= ORX_ERROR)  \
    127129     PRINT_EXEC
    128130  #else
     
    132134  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    133135   #define PRINT2 \
    134     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     136    if (getSoftDebugLevel() >= ORX_WARNING) \
    135137     PRINT_EXEC
    136138  #else
     
    140142  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    141143   #define PRINT3 \
    142     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     144    if (getSoftDebugLevel() >= ORX_INFO) \
    143145     PRINT_EXEC
    144146  #else
     
    148150  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    149151   #define PRINT4 \
    150     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     152    if (getSoftDebugLevel() >= ORX_DEBUG) \
    151153     PRINT_EXEC
    152154  #else
     
    156158  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    157159   #define PRINT5 \
    158     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     160    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    159161     PRINT_EXEC
    160162  #else
     
    188190  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
    189191   #define COUT1  \
    190     if (ORX_SOFT_DEBUG_LEVEL >= ORX_ERROR)  \
     192    if (getSoftDebugLevel() >= ORX_ERROR)  \
    191193     COUT_EXEC
    192194  #else
     
    197199  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
    198200   #define COUT2 \
    199     if (ORX_SOFT_DEBUG_LEVEL >= ORX_WARNING) \
     201    if (getSoftDebugLevel() >= ORX_WARNING) \
    200202     COUT_EXEC
    201203  #else
     
    206208  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
    207209   #define COUT3 \
    208     if (ORX_SOFT_DEBUG_LEVEL >= ORX_INFO) \
     210    if (getSoftDebugLevel() >= ORX_INFO) \
    209211     COUT_EXEC
    210212  #else
     
    215217  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
    216218   #define COUT4 \
    217     if (ORX_SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
     219    if (getSoftDebugLevel() >= ORX_DEBUG) \
    218220     COUT_EXEC
    219221  #else
     
    224226  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
    225227   #define COUT5 \
    226     if (ORX_SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
     228    if (getSoftDebugLevel() >= ORX_vDEBUG) \
    227229     COUT_EXEC
    228230  #else
  • code/branches/FICN/src/orxonox/core/Error.cc

    r513 r560  
    2727
    2828#include "Error.h"
     29#include "Debug.h"
    2930
    3031namespace orxonox
     
    4243        Error::Error(int errorCode, std::string errorMsg)
    4344        {
    44                 std::cout << "############################ "<< std::endl
     45                COUT(1) << "############################ "<< std::endl
    4546                                                        << "#         Error "<<errorCode<< "          #"<< std::endl
    4647                                                        << "############################ "<< std::endl
     
    5859                        }
    5960                }
    60                 std::cout << errorMsg << std::endl<< std::endl;
     61                COUT(1) << errorMsg << std::endl<< std::endl;
    6162        }
    6263}
  • code/branches/FICN/src/orxonox/core/SignalHandler.cc

    r497 r560  
    1414*/
    1515
     16#include <assert.h>
     17
    1618#include "SignalHandler.h"
    17 #include <assert.h>
     19#include "Debug.h"
    1820
    1921SignalHandler * SignalHandler::singletonRef = NULL;
     
    101103  }
    102104
    103   printf( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
     105  PRINTF(0)( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
    104106
    105107  int sigPipe[2];
     
    129131    if ( someData != 0x12345678 )
    130132    {
    131       printf("something went wrong :(\n");
     133      PRINTF(0)("something went wrong :(\n");
    132134    }
    133135
     
    278280  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
    279281  {
    280     printf( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
     282    PRINTF(0)( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
    281283    exit(EXIT_FAILURE);
    282284  }
Note: See TracChangeset for help on using the changeset viewer.