Add option to enable json logging
This commit is contained in:
parent
a372ade7ce
commit
f89f4bd20b
@ -27,6 +27,7 @@ if(WIN32 AND MSVC_VERSION LESS 1800)
|
|||||||
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
|
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF)
|
||||||
option(WITH_TOOLS "Build OSRM tools" OFF)
|
option(WITH_TOOLS "Build OSRM tools" OFF)
|
||||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||||
|
|
||||||
@ -298,6 +299,11 @@ include_directories(${ZLIB_INCLUDE_DIRS})
|
|||||||
target_link_libraries(osrm-extract ${ZLIB_LIBRARY})
|
target_link_libraries(osrm-extract ${ZLIB_LIBRARY})
|
||||||
target_link_libraries(osrm-routed ${ZLIB_LIBRARY})
|
target_link_libraries(osrm-routed ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
|
if (ENABLE_JSON_LOGGING)
|
||||||
|
message(STATUS "Enabling json logging")
|
||||||
|
add_definitions(-DENABLE_JSON_LOGGING)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_TOOLS OR BUILD_TOOLS)
|
if(WITH_TOOLS OR BUILD_TOOLS)
|
||||||
message(STATUS "Activating OSRM internal tools")
|
message(STATUS "Activating OSRM internal tools")
|
||||||
find_package(GDAL)
|
find_package(GDAL)
|
||||||
|
@ -48,11 +48,20 @@ class Logger
|
|||||||
{
|
{
|
||||||
static Logger logger;
|
static Logger logger;
|
||||||
|
|
||||||
|
bool return_logger = true;
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
return nullptr;
|
return_logger = false;
|
||||||
#else
|
|
||||||
return &logger;
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_JSON_LOGGING
|
||||||
|
return_logger = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (return_logger)
|
||||||
|
{
|
||||||
|
return &logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize(const std::string& name)
|
void initialize(const std::string& name)
|
||||||
|
Loading…
Reference in New Issue
Block a user