refactor SimpleLogger into simple_logger compile unit
This commit is contained in:
parent
ed960ccc8d
commit
274140d309
@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/TurnInstructions.h"
|
||||
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StdHashExtensions.h"
|
||||
#include "../Util/TimingUtil.h"
|
||||
|
||||
|
@ -53,12 +53,14 @@ configure_file(
|
||||
file(GLOB ExtractorGlob Extractor/*.cpp)
|
||||
file(GLOB ImporterGlob DataStructures/Import*.cpp)
|
||||
add_library(IMPORT OBJECT ${ImporterGlob})
|
||||
add_library(LOGGER OBJECT Util/simple_logger.cpp)
|
||||
|
||||
set(ExtractorSources extractor.cpp ${ExtractorGlob})
|
||||
add_executable(osrm-extract ${ExtractorSources} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:IMPORT>)
|
||||
add_executable(osrm-extract ${ExtractorSources} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:LOGGER>)
|
||||
|
||||
file(GLOB PrepareGlob Contractor/*.cpp DataStructures/HilbertValue.cpp DataStructures/RestrictionMap.cpp Util/compute_angle.cpp)
|
||||
set(PrepareSources prepare.cpp ${PrepareGlob})
|
||||
add_executable(osrm-prepare ${PrepareSources} $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:IMPORT>)
|
||||
add_executable(osrm-prepare ${PrepareSources} $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:LOGGER>)
|
||||
|
||||
file(GLOB ServerGlob Server/*.cpp)
|
||||
file(GLOB DescriptorGlob Descriptors/*.cpp)
|
||||
@ -84,14 +86,14 @@ add_library(OSRM ${OSRMSources} Util/GitDescription.cpp Util/FingerPrint.cpp $<T
|
||||
add_library(GITDESCRIPTION OBJECT Util/GitDescription.cpp)
|
||||
add_dependencies(FINGERPRINT FingerPrintConfigure)
|
||||
|
||||
add_executable(osrm-routed routed.cpp ${ServerGlob})
|
||||
add_executable(osrm-datastore datastore.cpp $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION>)
|
||||
add_executable(osrm-routed routed.cpp ${ServerGlob} $<TARGET_OBJECTS:LOGGER>)
|
||||
add_executable(osrm-datastore datastore.cpp $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:LOGGER>)
|
||||
|
||||
# Unit tests
|
||||
add_executable(datastructure-tests EXCLUDE_FROM_ALL UnitTests/datastructure_tests.cpp ${DataStructureTestsGlob} $<TARGET_OBJECTS:COORDINATE>)
|
||||
add_executable(datastructure-tests EXCLUDE_FROM_ALL UnitTests/datastructure_tests.cpp ${DataStructureTestsGlob} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:LOGGER>)
|
||||
|
||||
# Benchmarks
|
||||
add_executable(rtree-bench EXCLUDE_FROM_ALL Benchmarks/StaticRTreeBench.cpp $<TARGET_OBJECTS:COORDINATE>)
|
||||
add_executable(rtree-bench EXCLUDE_FROM_ALL Benchmarks/StaticRTreeBench.cpp $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:LOGGER>)
|
||||
|
||||
# Check the release mode
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
@ -262,7 +264,7 @@ if(WITH_TOOLS OR BUILD_TOOLS)
|
||||
message(STATUS "Activating OSRM internal tools")
|
||||
find_package(GDAL)
|
||||
if(GDAL_FOUND)
|
||||
add_executable(osrm-components Tools/components.cpp $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:COORDINATE>)
|
||||
add_executable(osrm-components Tools/components.cpp $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-components ${TBB_LIBRARIES})
|
||||
include_directories(${GDAL_INCLUDE_DIR})
|
||||
target_link_libraries(
|
||||
@ -272,19 +274,19 @@ if(WITH_TOOLS OR BUILD_TOOLS)
|
||||
else()
|
||||
message(FATAL_ERROR "libgdal and/or development headers not found")
|
||||
endif()
|
||||
add_executable(osrm-cli Tools/simpleclient.cpp)
|
||||
add_executable(osrm-cli Tools/simpleclient.cpp $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-cli ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} OSRM)
|
||||
target_link_libraries(osrm-cli ${TBB_LIBRARIES})
|
||||
add_executable(osrm-io-benchmark Tools/io-benchmark.cpp $<TARGET_OBJECTS:GITDESCRIPTION>)
|
||||
add_executable(osrm-io-benchmark Tools/io-benchmark.cpp $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-io-benchmark ${Boost_LIBRARIES})
|
||||
add_executable(osrm-unlock-all Tools/unlock_all_mutexes.cpp $<TARGET_OBJECTS:GITDESCRIPTION>)
|
||||
add_executable(osrm-unlock-all Tools/unlock_all_mutexes.cpp $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-unlock-all ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(osrm-unlock-all rt)
|
||||
endif()
|
||||
add_executable(osrm-check-hsgr Tools/check-hsgr.cpp $<TARGET_OBJECTS:FINGERPRINT>)
|
||||
add_executable(osrm-check-hsgr Tools/check-hsgr.cpp $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-check-hsgr ${Boost_LIBRARIES})
|
||||
add_executable(osrm-springclean Tools/springclean.cpp $<TARGET_OBJECTS:FINGERPRINT>)
|
||||
add_executable(osrm-springclean Tools/springclean.cpp $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:LOGGER>)
|
||||
target_link_libraries(osrm-springclean ${Boost_LIBRARIES})
|
||||
|
||||
install(TARGETS osrm-cli DESTINATION bin)
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/Range.h"
|
||||
#include "../DataStructures/XORFastHash.h"
|
||||
#include "../DataStructures/XORFastHashStorage.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../Util/TimingUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/Range.h"
|
||||
#include "../Util/compute_angle.hpp"
|
||||
#include "../Util/LuaUtil.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/TimingUtil.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "GeometryCompressor.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Util/GitDescription.h"
|
||||
#include "../Util/LuaUtil.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../Util/TimingUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <osrm/Coordinate.h>
|
||||
#include "../Util/MercatorUtil.h"
|
||||
#ifndef NDEBUG
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#endif
|
||||
#include "../Util/StringUtil.h"
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define EDGE_BASED_NODE_H
|
||||
|
||||
#include "../DataStructures/TravelMode.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <osrm/Coordinate.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "DynamicGraph.h"
|
||||
#include "ImportEdge.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <tbb/parallel_sort.h>
|
||||
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <osrm/Coordinate.h>
|
||||
#include "../DataStructures/TravelMode.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <vector>
|
||||
@ -82,7 +82,7 @@ struct PhantomNode
|
||||
unsigned short fwd_segment_position;
|
||||
TravelMode forward_travel_mode : 4;
|
||||
TravelMode backward_travel_mode : 4;
|
||||
|
||||
|
||||
int GetForwardWeightPlusOffset() const
|
||||
{
|
||||
if (SPECIAL_NODEID == forward_node_id)
|
||||
|
@ -28,8 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "RestrictionMap.h"
|
||||
#include "NodeBasedGraph.h"
|
||||
|
||||
#include "../Util/SimpleLogger.h"
|
||||
|
||||
bool RestrictionMap::IsViaNode(const NodeID node) const
|
||||
{
|
||||
return m_no_turn_via_node_set.find(node) != m_no_turn_via_node_set.end();
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define SHARED_MEMORY_FACTORY_H
|
||||
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
@ -28,8 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef SHARED_MEMORY_VECTOR_WRAPPER_H
|
||||
#define SHARED_MEMORY_VECTOR_WRAPPER_H
|
||||
|
||||
#include "../Util/SimpleLogger.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Percent.h"
|
||||
#include "Range.h"
|
||||
#include "SharedMemoryVectorWrapper.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Util/floating_point.hpp"
|
||||
#include "../Util/MercatorUtil.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/TimingUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/ImportNode.h"
|
||||
#include "../Util/LuaUtil.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/regex.hpp>
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "ExtractionContainers.h"
|
||||
#include "ExtractionWay.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/TimingUtil.h"
|
||||
#include "../DataStructures/RangeTable.h"
|
||||
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Util/GitDescription.h"
|
||||
#include "../Util/IniFileUtil.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/TimingUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../DataStructures/ImportNode.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <osrm/Coordinate.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/MachineInfo.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <zlib.h>
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <thread>
|
||||
|
||||
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/ImportNode.h"
|
||||
#include "../Util/LuaUtil.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/InputReaderFactory.h"
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/cast.hpp"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace boost { namespace interprocess { class named_mutex; } }
|
||||
#include "../Server/DataStructures/SharedDataFacade.h"
|
||||
#include "../Util/make_unique.hpp"
|
||||
#include "../Util/ProgramOptions.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/interprocess/sync/named_condition.hpp>
|
||||
|
@ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/QueryEdge.h"
|
||||
#include "../DataStructures/SearchEngine.h"
|
||||
#include "../Descriptors/BaseDescriptor.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../Util/TimingUtil.h"
|
||||
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Descriptors/BaseDescriptor.h"
|
||||
#include "../Descriptors/GPXDescriptor.h"
|
||||
#include "../Descriptors/JSONDescriptor.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../Util/TimingUtil.h"
|
||||
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/RawRouteData.h"
|
||||
#include "../DataStructures/SearchEngineData.h"
|
||||
#include "../DataStructures/TurnInstructions.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
// #include "../Util/simple_logger.hpp.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
|
@ -42,7 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../../Util/BoostFileSystemFix.h"
|
||||
#include "../../Util/GraphLoader.h"
|
||||
#include "../../Util/ProgramOptions.h"
|
||||
#include "../../Util/SimpleLogger.h"
|
||||
#include "../../Util/simple_logger.hpp"
|
||||
|
||||
#include <osrm/Coordinate.h>
|
||||
|
||||
|
@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../../DataStructures/StaticRTree.h"
|
||||
#include "../../Util/BoostFileSystemFix.h"
|
||||
#include "../../Util/ProgramOptions.h"
|
||||
#include "../../Util/SimpleLogger.h"
|
||||
#include "../../Util/simple_logger.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define SHARED_DATA_TYPE_H_
|
||||
|
||||
#include "../../Util/OSRMException.h"
|
||||
#include "../../Util/SimpleLogger.h"
|
||||
#include "../../Util/simple_logger.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "../DataStructures/JSONContainer.h"
|
||||
#include "../Library/OSRM.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "../Util/cast.hpp"
|
||||
#include "../Util/make_unique.hpp"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/Range.h"
|
||||
#include "../DataStructures/StaticGraph.h"
|
||||
#include "../Util/GraphLoader.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Algorithms/StronglyConnectedComponents.h"
|
||||
#include "../Util/GraphLoader.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/FingerPrint.h"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "../Util/GitDescription.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/TimingUtil.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../Library/OSRM.h"
|
||||
#include "../Util/GitDescription.h"
|
||||
#include "../Util/ProgramOptions.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
#include <osrm/Reply.h>
|
||||
#include <osrm/RouteParameters.h>
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "../DataStructures/SharedMemoryFactory.h"
|
||||
#include "../Server/DataStructures/SharedDataType.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
|
||||
void delete_region(const SharedDataType region)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "../Util/GitDescription.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Server/DataStructures/SharedBarriers.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define BOOST_FILE_SYSTEM_FIX_H
|
||||
|
||||
#include "OSRMException.h"
|
||||
#include "SimpleLogger.h"
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@ -60,8 +59,6 @@ namespace filesystem
|
||||
// boost::program_options::validators::check_first_occurrence(v);
|
||||
// const std::string & input_string =
|
||||
// boost::program_options::validators::get_single_string(values);
|
||||
// // SimpleLogger().Write() << "validator called for " << input_string;
|
||||
// // SimpleLogger().Write() << "validator called for " << input_string;
|
||||
// if(boost::filesystem::is_regular_file(input_string)) {
|
||||
// v = boost::any(boost::filesystem::path(input_string));
|
||||
// } else {
|
||||
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "GitDescription.h"
|
||||
#include "IniFileUtil.h"
|
||||
#include "OSRMException.h"
|
||||
#include "SimpleLogger.h"
|
||||
#include "simple_logger.hpp"
|
||||
|
||||
#include <osrm/ServerPaths.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../DataStructures/ImportEdge.h"
|
||||
#include "../DataStructures/QueryNode.h"
|
||||
#include "../DataStructures/Restriction.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/simple_logger.hpp"
|
||||
#include "../Util/FingerPrint.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "GitDescription.h"
|
||||
#include "IniFileUtil.h"
|
||||
#include "OSRMException.h"
|
||||
#include "SimpleLogger.h"
|
||||
#include "simple_logger.hpp"
|
||||
|
||||
#include <osrm/ServerPaths.h>
|
||||
|
||||
|
@ -1,159 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef SIMPLE_LOGGER_H
|
||||
#define SIMPLE_LOGGER_H
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#define isatty _isatty
|
||||
#define fileno _fileno
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
|
||||
enum LogLevel
|
||||
{ logINFO,
|
||||
logWARNING,
|
||||
logDEBUG };
|
||||
|
||||
const char COL_RESET[] = "\x1b[0m";
|
||||
const char RED[] = "\x1b[31m";
|
||||
const char GREEN[] = "\x1b[32m";
|
||||
const char YELLOW[] = "\x1b[33m";
|
||||
const char BLUE[] = "\x1b[34m";
|
||||
const char MAGENTA[] = "\x1b[35m";
|
||||
const char CYAN[] = "\x1b[36m";
|
||||
|
||||
class LogPolicy
|
||||
{
|
||||
public:
|
||||
void Unmute() { m_is_mute = false; }
|
||||
|
||||
void Mute() { m_is_mute = true; }
|
||||
|
||||
bool IsMute() const { return m_is_mute; }
|
||||
|
||||
static LogPolicy &GetInstance()
|
||||
{
|
||||
static LogPolicy runningInstance;
|
||||
return runningInstance;
|
||||
}
|
||||
|
||||
LogPolicy(const LogPolicy &) = delete;
|
||||
|
||||
private:
|
||||
LogPolicy() : m_is_mute(true) {}
|
||||
std::atomic<bool> m_is_mute;
|
||||
};
|
||||
|
||||
class SimpleLogger
|
||||
{
|
||||
public:
|
||||
SimpleLogger() : level(logINFO) {}
|
||||
|
||||
std::mutex& get_mutex()
|
||||
{
|
||||
static std::mutex m;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream &Write(LogLevel l = logINFO)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(get_mutex());
|
||||
try
|
||||
{
|
||||
level = l;
|
||||
os << "[";
|
||||
switch (level)
|
||||
{
|
||||
case logINFO:
|
||||
os << "info";
|
||||
break;
|
||||
case logWARNING:
|
||||
os << "warn";
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifndef NDEBUG
|
||||
os << "debug";
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
BOOST_ASSERT_MSG(false, "should not happen");
|
||||
break;
|
||||
}
|
||||
os << "] ";
|
||||
}
|
||||
catch (...) {}
|
||||
return os;
|
||||
}
|
||||
|
||||
virtual ~SimpleLogger()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(get_mutex());
|
||||
if (!LogPolicy::GetInstance().IsMute())
|
||||
{
|
||||
const bool is_terminal = ( 0 != isatty(fileno(stdout)) ? true : false);
|
||||
switch (level)
|
||||
{
|
||||
case logINFO:
|
||||
std::cout << os.str() << (is_terminal ? COL_RESET : "") << std::endl;
|
||||
break;
|
||||
case logWARNING:
|
||||
std::cerr << (is_terminal ? RED : "") << os.str() << (is_terminal ? COL_RESET : "")
|
||||
<< std::endl;
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifndef NDEBUG
|
||||
std::cout << (is_terminal ? YELLOW : "") << os.str()
|
||||
<< (is_terminal ? COL_RESET : "") << std::endl;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
BOOST_ASSERT_MSG(false, "should not happen");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
LogLevel level;
|
||||
std::ostringstream os;
|
||||
};
|
||||
|
||||
#endif /* SIMPLE_LOGGER_H */
|
137
Util/simple_logger.cpp
Normal file
137
Util/simple_logger.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "simple_logger.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#define isatty _isatty
|
||||
#define fileno _fileno
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
|
||||
namespace
|
||||
{
|
||||
static const char COL_RESET[] { "\x1b[0m"};
|
||||
static const char RED[] { "\x1b[31m"};
|
||||
#ifndef NDEBUG
|
||||
static const char YELLOW[] { "\x1b[33m"};
|
||||
#endif
|
||||
// static const char GREEN[] { "\x1b[32m"};
|
||||
// static const char BLUE[] { "\x1b[34m"};
|
||||
// static const char MAGENTA[] { "\x1b[35m"};
|
||||
// static const char CYAN[] { "\x1b[36m"};
|
||||
}
|
||||
|
||||
void LogPolicy::Unmute() { m_is_mute = false; }
|
||||
|
||||
void LogPolicy::Mute() { m_is_mute = true; }
|
||||
|
||||
bool LogPolicy::IsMute() const { return m_is_mute; }
|
||||
|
||||
LogPolicy &LogPolicy::GetInstance()
|
||||
{
|
||||
static LogPolicy runningInstance;
|
||||
return runningInstance;
|
||||
}
|
||||
|
||||
SimpleLogger::SimpleLogger() : level(logINFO) {}
|
||||
|
||||
std::mutex &SimpleLogger::get_mutex()
|
||||
{
|
||||
static std::mutex m;
|
||||
return m;
|
||||
}
|
||||
|
||||
std::ostringstream &SimpleLogger::Write(LogLevel l)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(get_mutex());
|
||||
try
|
||||
{
|
||||
level = l;
|
||||
os << "[";
|
||||
switch (level)
|
||||
{
|
||||
case logINFO:
|
||||
os << "info";
|
||||
break;
|
||||
case logWARNING:
|
||||
os << "warn";
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifndef NDEBUG
|
||||
os << "debug";
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
BOOST_ASSERT_MSG(false, "should not happen");
|
||||
break;
|
||||
}
|
||||
os << "] ";
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
SimpleLogger::~SimpleLogger()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(get_mutex());
|
||||
if (!LogPolicy::GetInstance().IsMute())
|
||||
{
|
||||
const bool is_terminal = (0 != isatty(fileno(stdout)) ? true : false);
|
||||
switch (level)
|
||||
{
|
||||
case logINFO:
|
||||
std::cout << os.str() << (is_terminal ? COL_RESET : "") << std::endl;
|
||||
break;
|
||||
case logWARNING:
|
||||
std::cerr << (is_terminal ? RED : "") << os.str() << (is_terminal ? COL_RESET : "")
|
||||
<< std::endl;
|
||||
break;
|
||||
case logDEBUG:
|
||||
#ifndef NDEBUG
|
||||
std::cout << (is_terminal ? YELLOW : "") << os.str() << (is_terminal ? COL_RESET : "")
|
||||
<< std::endl;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
BOOST_ASSERT_MSG(false, "should not happen");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
73
Util/simple_logger.hpp
Normal file
73
Util/simple_logger.hpp
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef SIMPLE_LOGGER_HPP
|
||||
#define SIMPLE_LOGGER_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <sstream>
|
||||
|
||||
enum LogLevel
|
||||
{
|
||||
logINFO,
|
||||
logWARNING,
|
||||
logDEBUG
|
||||
};
|
||||
|
||||
class LogPolicy
|
||||
{
|
||||
public:
|
||||
void Unmute();
|
||||
|
||||
void Mute();
|
||||
|
||||
bool IsMute() const;
|
||||
|
||||
static LogPolicy &GetInstance();
|
||||
|
||||
LogPolicy(const LogPolicy &) = delete;
|
||||
|
||||
private:
|
||||
LogPolicy() : m_is_mute(true) {}
|
||||
std::atomic<bool> m_is_mute;
|
||||
};
|
||||
|
||||
class SimpleLogger
|
||||
{
|
||||
public:
|
||||
SimpleLogger();
|
||||
|
||||
virtual ~SimpleLogger();
|
||||
std::mutex &get_mutex();
|
||||
std::ostringstream &Write(LogLevel l = logINFO);
|
||||
|
||||
private:
|
||||
LogLevel level;
|
||||
std::ostringstream os;
|
||||
};
|
||||
|
||||
#endif /* SIMPLE_LOGGER_HPP */
|
@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Server/DataStructures/SharedBarriers.h"
|
||||
#include "Util/BoostFileSystemFix.h"
|
||||
#include "Util/DataStoreOptions.h"
|
||||
#include "Util/SimpleLogger.h"
|
||||
#include "Util/simple_logger.hpp"
|
||||
#include "Util/FingerPrint.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "Server/Server.h"
|
||||
#include "Util/GitDescription.h"
|
||||
#include "Util/ProgramOptions.h"
|
||||
#include "Util/SimpleLogger.h"
|
||||
#include "Util/simple_logger.hpp"
|
||||
#include "Util/FingerPrint.h"
|
||||
|
||||
#ifdef __linux__
|
||||
|
Loading…
Reference in New Issue
Block a user