From d1f555dcefff235af823a56ce8c7e9d0e5d957a8 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Wed, 7 Sep 2016 16:49:05 +0200 Subject: [PATCH] Removes unused JSON logger. References: - https://github.com/Project-OSRM/osrm-backend/pull/2769 --- CMakeLists.txt | 6 -- .../routing_algorithms/map_matching.hpp | 1 - include/util/json_logger.hpp | 62 ------------------- src/engine/plugins/match.cpp | 1 - 4 files changed, 70 deletions(-) delete mode 100644 include/util/json_logger.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c6c0758eb..d51b81c16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ if(WIN32 AND MSVC_VERSION LESS 1900) endif() option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON) -option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF) option(BUILD_TOOLS "Build OSRM tools" OFF) option(BUILD_COMPONENTS "Build osrm-components" OFF) option(ENABLE_ASSERTIONS OFF) @@ -332,11 +331,6 @@ add_dependency_includes(${BZIP2_INCLUDE_DIR}) find_package(ZLIB REQUIRED) add_dependency_includes(${ZLIB_INCLUDE_DIRS}) -if (ENABLE_JSON_LOGGING) - message(STATUS "Enabling json logging") - add_dependency_defines(-DENABLE_JSON_LOGGING) -endif() - add_definitions(${OSRM_DEFINES}) include_directories(SYSTEM ${OSRM_INCLUDE_PATHS}) diff --git a/include/engine/routing_algorithms/map_matching.hpp b/include/engine/routing_algorithms/map_matching.hpp index 343e26ab8..ac0e4269e 100644 --- a/include/engine/routing_algorithms/map_matching.hpp +++ b/include/engine/routing_algorithms/map_matching.hpp @@ -9,7 +9,6 @@ #include "util/coordinate_calculation.hpp" #include "util/for_each_pair.hpp" -#include "util/json_logger.hpp" #include diff --git a/include/util/json_logger.hpp b/include/util/json_logger.hpp deleted file mode 100644 index aa72b54cf..000000000 --- a/include/util/json_logger.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef JSON_LOGGER_HPP -#define JSON_LOGGER_HPP - -#include "osrm/json_container.hpp" - -#include - -#include -#include - -namespace osrm -{ -namespace util -{ -namespace json -{ - -// Used to append additional debugging information to the JSON response in a -// thread safe manner. -class Logger -{ - using MapT = std::unordered_map; - - public: - static Logger *get() - { - static Logger logger; - - bool return_logger = true; -#ifdef NDEBUG - return_logger = false; -#endif -#ifdef ENABLE_JSON_LOGGING - return_logger = true; -#endif - - if (return_logger) - { - return &logger; - } - - return nullptr; - } - - void initialize(const std::string &name) - { - if (!map.get()) - { - map.reset(new MapT()); - } - (*map)[name] = Object(); - } - - void render(const std::string &name, Object &obj) const { obj.values["debug"] = map->at(name); } - - boost::thread_specific_ptr map; -}; -} -} -} - -#endif /* JSON_LOGGER_HPP */ diff --git a/src/engine/plugins/match.cpp b/src/engine/plugins/match.cpp index 41e0d7915..9b0ba4579 100644 --- a/src/engine/plugins/match.cpp +++ b/src/engine/plugins/match.cpp @@ -6,7 +6,6 @@ #include "engine/map_matching/bayes_classifier.hpp" #include "util/coordinate_calculation.hpp" #include "util/integer_range.hpp" -#include "util/json_logger.hpp" #include "util/json_util.hpp" #include "util/string_util.hpp"