Merge pull request #5628 from wangyoucao577/feature/disable-debug-log-compile-time-control
Control release mode debug logging output by ENABLE_DEBUG_LOGGING option
This commit is contained in:
commit
b9ebe0c369
@ -19,6 +19,7 @@
|
|||||||
- FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [#5622](https://github.com/Project-OSRM/osrm-backend/pull/5622)
|
- FIXED: treat `bicycle=use_sidepath` as no access on the tagged way. [#5622](https://github.com/Project-OSRM/osrm-backend/pull/5622)
|
||||||
- Misc:
|
- Misc:
|
||||||
- CHANGED: Reduce memory usage for raster source handling. [#5572](https://github.com/Project-OSRM/osrm-backend/pull/5572)
|
- CHANGED: Reduce memory usage for raster source handling. [#5572](https://github.com/Project-OSRM/osrm-backend/pull/5572)
|
||||||
|
- CHANGED: Add cmake option `ENABLE_DEBUG_LOGGING` to control whether output debug logging. [#3427](https://github.com/Project-OSRM/osrm-backend/issues/3427)
|
||||||
|
|
||||||
# 5.21.0
|
# 5.21.0
|
||||||
- Changes from 5.20.0
|
- Changes from 5.20.0
|
||||||
|
@ -23,6 +23,7 @@ option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
|||||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||||
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||||
|
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
||||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||||
option(ENABLE_STXXL "Use STXXL library" OFF)
|
option(ENABLE_STXXL "Use STXXL library" OFF)
|
||||||
@ -233,6 +234,7 @@ endif()
|
|||||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||||
message(STATUS "Configuring debug mode flags")
|
message(STATUS "Configuring debug mode flags")
|
||||||
set(ENABLE_ASSERTIONS ON)
|
set(ENABLE_ASSERTIONS ON)
|
||||||
|
set(ENABLE_DEBUG_LOGGING ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
@ -737,6 +739,11 @@ if (ENABLE_ASSERTIONS)
|
|||||||
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
|
add_definitions(-DBOOST_ENABLE_ASSERT_HANDLER)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEBUG_LOGGING)
|
||||||
|
message(STATUS "Enabling debug logging")
|
||||||
|
add_definitions(-DENABLE_DEBUG_LOGGING)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add RPATH info to executables so that when they are run after being installed
|
# Add RPATH info to executables so that when they are run after being installed
|
||||||
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
|
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For
|
||||||
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
|
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||||
|
@ -16,7 +16,7 @@ namespace
|
|||||||
static const char COL_RESET[]{"\x1b[0m"};
|
static const char COL_RESET[]{"\x1b[0m"};
|
||||||
static const char RED[]{"\x1b[31m"};
|
static const char RED[]{"\x1b[31m"};
|
||||||
static const char YELLOW[]{"\x1b[33m"};
|
static const char YELLOW[]{"\x1b[33m"};
|
||||||
#ifndef NDEBUG
|
#ifdef ENABLE_DEBUG_LOGGING
|
||||||
static const char MAGENTA[]{"\x1b[35m"};
|
static const char MAGENTA[]{"\x1b[35m"};
|
||||||
#endif
|
#endif
|
||||||
// static const char GREEN[] { "\x1b[32m"};
|
// static const char GREEN[] { "\x1b[32m"};
|
||||||
@ -80,7 +80,7 @@ Log::Log(LogLevel level_, std::ostream &ostream) : level(level_), stream(ostream
|
|||||||
stream << (is_terminal ? RED : "") << "[error] ";
|
stream << (is_terminal ? RED : "") << "[error] ";
|
||||||
break;
|
break;
|
||||||
case logDEBUG:
|
case logDEBUG:
|
||||||
#ifndef NDEBUG
|
#ifdef ENABLE_DEBUG_LOGGING
|
||||||
stream << (is_terminal ? MAGENTA : "") << "[debug] ";
|
stream << (is_terminal ? MAGENTA : "") << "[debug] ";
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@ -126,7 +126,7 @@ Log::~Log()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
case logDEBUG:
|
case logDEBUG:
|
||||||
#ifdef NDEBUG
|
#ifndef ENABLE_DEBUG_LOGGING
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case logINFO:
|
case logINFO:
|
||||||
|
Loading…
Reference in New Issue
Block a user