From fc610b52f758bbed1e84e41fd4c60c5f4b70b9b5 Mon Sep 17 00:00:00 2001 From: Maaike Zijderveld Date: Thu, 24 Aug 2023 16:28:25 +0200 Subject: [PATCH] Make it possible to use own logger instead of everest logger. (#150) * Make it possible to use own logger instead of everest logger. Signed-off-by: Maaike Zijderveld, Alfen * formatting Signed-off-by: Maaike Zijderveld, Alfen --------- Signed-off-by: Maaike Zijderveld, Alfen Co-authored-by: Patrick van Bennekom --- include/ocpp/common/charging_station_base.hpp | 2 ++ lib/CMakeLists.txt | 29 ++++++++++++++++++- lib/ocpp/common/charging_station_base.cpp | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/ocpp/common/charging_station_base.hpp b/include/ocpp/common/charging_station_base.hpp index 062009e04..0bb61edd8 100644 --- a/include/ocpp/common/charging_station_base.hpp +++ b/include/ocpp/common/charging_station_base.hpp @@ -3,6 +3,8 @@ #ifndef OCPP_COMMON_CHARGE_POINT_HPP #define OCPP_COMMON_CHARGE_POINT_HPP +#include + #include #include #include diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index bbe37978d..588bd2a36 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -47,9 +47,36 @@ target_include_directories(ocpp $ ) +############# +# Logging configuration +############# +if (EVEREST_CUSTOM_LOGGING_INCLUDE_PATH) + if (NOT EXISTS "${EVEREST_CUSTOM_LOGGING_INCLUDE_PATH}/everest/logging.hpp") + message(FATAL_ERROR "everest/logging.hpp not found in directory ${EVEREST_CUSTOM_LOGGING_INCLUDE_PATH}") + else() + target_include_directories(ocpp + PUBLIC + include + ${EVEREST_CUSTOM_LOGGING_INCLUDE_PATH} + ) + endif() + message(STATUS "Using the following logging header: ${EVEREST_CUSTOM_LOGGING_INCLUDE_PATH}/everest/logging.hpp") +endif() + +if (NOT EVEREST_CUSTOM_LOGGING_INCLUDE_PATH) + target_link_libraries(ocpp + PUBLIC + everest::log + ) + message(STATUS "Using the default logging header") +endif() + +############# +# End logging configuration +############# + target_link_libraries(ocpp PUBLIC - everest::log everest::timer websocketpp::websocketpp nlohmann_json_schema_validator diff --git a/lib/ocpp/common/charging_station_base.cpp b/lib/ocpp/common/charging_station_base.cpp index 6d1da8918..832d225cb 100644 --- a/lib/ocpp/common/charging_station_base.cpp +++ b/lib/ocpp/common/charging_station_base.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest +#include #include namespace ocpp {