Browse Source

Cmake option to disable debug and trace outputs

Former-commit-id: 9758862579
tempestpy_adaptions
sjunges 9 years ago
parent
commit
8c2cb4887f
  1. 1
      CMakeLists.txt
  2. 30
      src/utility/macros.h
  3. 2
      storm-config.h.in

1
CMakeLists.txt

@ -29,6 +29,7 @@ option(USE_CARL "Sets whether carl should be included." ON)
option(FORCE_COLOR "Force color output" OFF) option(FORCE_COLOR "Force color output" OFF)
option(STORM_COMPILE_WITH_CCACHE "Compile using CCache" ON) option(STORM_COMPILE_WITH_CCACHE "Compile using CCache" ON)
option(STORM_LOGGING_FRAMEWORK "Use a framework for logging" OFF) option(STORM_LOGGING_FRAMEWORK "Use a framework for logging" OFF)
option(STORM_LOG_DISABLE_DEBUG "Disable log and trace message support" OFF)
set(GUROBI_ROOT "" CACHE STRING "A hint to the root directory of Gurobi (optional).") set(GUROBI_ROOT "" CACHE STRING "A hint to the root directory of Gurobi (optional).")
set(Z3_ROOT "" CACHE STRING "A hint to the root directory of Z3 (optional).") set(Z3_ROOT "" CACHE STRING "A hint to the root directory of Z3 (optional).")
set(CUDA_ROOT "" CACHE STRING "The root directory of CUDA.") set(CUDA_ROOT "" CACHE STRING "The root directory of CUDA.")

30
src/utility/macros.h

@ -16,6 +16,12 @@ extern int storm_runtime_loglevel;
#define STORM_LOGLEVEL_DEBUG 3 #define STORM_LOGLEVEL_DEBUG 3
#define STORM_LOGLEVEL_TRACE 4 #define STORM_LOGLEVEL_TRACE 4
#ifdef STORM_LOG_DISABLE_DEBUG
#define STORM_LOG_DISABLE_TRACE
#endif
#ifndef STORM_LOG_DISABLE_DEBUG
#define STORM_LOG_DEBUG(message) \ #define STORM_LOG_DEBUG(message) \
do { \ do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_DEBUG) { \ if(storm_runtime_loglevel >= STORM_LOGLEVEL_DEBUG) { \
@ -24,15 +30,26 @@ do { \
std::cout << "LOG DBG: " << __ss.str() << std::endl; \ std::cout << "LOG DBG: " << __ss.str() << std::endl; \
} \ } \
} while (false) } while (false)
#else
#define STORM_LOG_DEBUG(message) \
do { \
} while (false)
#endif
#ifndef STORM_LOG_DISABLE_TRACE
#define STORM_LOG_TRACE(message) \ #define STORM_LOG_TRACE(message) \
do { \ do { \
if(storm_runtime_loglevel >= STORM_LOGLEVEL_TRACE) { \ if(storm_runtime_loglevel >= STORM_LOGLEVEL_TRACE) { \
std::stringstream __ss; \ std::stringstream __ss; \
__ss << message; \ __ss << message; \
std::cout << "LOG TRC: " << message << std::endl; \
std::cout << "LOG TRC: " << __ss.str() << std::endl; \
} \ } \
} while(false) } while(false)
#else
#define STORM_LOG_TRACE(message) \
do { \
} while (false)
#endif
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set. // Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set.
@ -112,15 +129,26 @@ do { \
storm_runtime_loglevel = STORM_LOGLEVEL_INFO; \ storm_runtime_loglevel = STORM_LOGLEVEL_INFO; \
} while (false) } while (false)
#ifndef STORM_LOG_DISABLE_DEBUG
#define STORM_GLOBAL_LOGLEVEL_DEBUG() \ #define STORM_GLOBAL_LOGLEVEL_DEBUG() \
do { \ do { \
storm_runtime_loglevel = STORM_LOGLEVEL_DEBUG; \ storm_runtime_loglevel = STORM_LOGLEVEL_DEBUG; \
} while(false) } while(false)
#else
#define STORM_GLOBAL_LOGLEVEL_DEBUG() \
std::cout << "***** warning ***** loglevel debug is not compiled\n"
#endif
#ifndef STORM_LOG_DISABLE_TRACE
#define STORM_GLOBAL_LOGLEVEL_TRACE() \ #define STORM_GLOBAL_LOGLEVEL_TRACE() \
do { \ do { \
storm_runtime_loglevel = STORM_LOGLEVEL_TRACE; \ storm_runtime_loglevel = STORM_LOGLEVEL_TRACE; \
} while(false) } while(false)
#else
#define STORM_GLOBAL_LOGLEVEL_TRACE() \
std::cout << "***** warning ***** loglevel trace is not compiled\n"
#endif
#else #else
// Include the parts necessary for Log4cplus. // Include the parts necessary for Log4cplus.

2
storm-config.h.in

@ -46,4 +46,6 @@
#cmakedefine STORM_LOGGING_FRAMEWORK #cmakedefine STORM_LOGGING_FRAMEWORK
#cmakedefine STORM_LOG_DISABLE_DEBUG
#endif // STORM_GENERATED_STORMCONFIG_H_ #endif // STORM_GENERATED_STORMCONFIG_H_
Loading…
Cancel
Save