summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorShobhit Adlakha <ShobhitAd@users.noreply.github.com>2021-04-30 13:52:07 -0400
committerGitHub <noreply@github.com>2021-04-30 13:52:07 -0400
commit4dc2bd9a278628c8b952fc1f480eaa550f9cdcae (patch)
treecc12319aee6078badc97a4e6122813d28b34a1d3 /CMakeLists.txt
parent74ea4bb79b6adf00702e68cf5d502bc3def0f285 (diff)
downloadsdl_core-4dc2bd9a278628c8b952fc1f480eaa550f9cdcae.tar.gz
Feature/Boost Logger Implementation (#3571)
* Implement 3rd-party Boost logger * Add boost log config file * Implement log filtering and formatting for the different sinks * Fix Timestamp calculation * Fix function trace string * Implement setting to disable particular sinks * Add append option to file sinks * Telnet logger configuration * Add cmake flag to switch beetween loggers * Remove log4cxx appender include * Style fix * Modify BoostLogConfig file for tests to match the log4cxx properties file * Exclude log4cxx related libraries * Address review comments * Add changes to only install boost log if the correct LOGGER_NAME is set * Fix implementation for removing disabled sinks * Add note for isEnabledFor function * Address review comment * Fix smartobject linking error * Address review comments
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 22 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 764a050b91..844319ed62 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,12 @@ option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
option(USE_CCACHE "Turn on ccache usage" ON)
option(USE_DISTCC "Turn on distributed build_usage" OFF)
+set(LOGGER_NAME "LOG4CXX" CACHE STRING "Logging library to use (BOOST, LOG4CXX)")
+set_property(CACHE LOGGER_NAME PROPERTY STRINGS BOOST LOG4CXX)
+if(LOGGER_NAME STREQUAL "")
+ set(LOGGER_NAME "LOG4CXX")
+endif()
+
set (EXTENDED_POLICY "PROPRIETARY" CACHE STRING "Policy mode (PROPRIETARY, HTTP or EXTERNAL_PROPRIETARY)")
set_property(CACHE EXTENDED_POLICY PROPERTY STRINGS PROPRIETARY HTTP EXTERNAL_PROPRIETARY)
if(EXTENDED_POLICY STREQUAL "")
@@ -186,6 +192,12 @@ get_property(cValue CACHE ENABLE_SECURITY PROPERTY VALUE)
file(APPEND "${build_config_path}" "//${cHelpString}\n")
file(APPEND "${build_config_path}" "ENABLE_SECURITY:${cType}=${cValue}\n\n")
+get_property(cHelpString CACHE LOGGER_NAME PROPERTY HELPSTRING)
+get_property(cType CACHE LOGGER_NAME PROPERTY TYPE)
+get_property(cValue CACHE LOGGER_NAME PROPERTY VALUE)
+file(APPEND "${build_config_path}" "//${cHelpString}\n")
+file(APPEND "${build_config_path}" "LOGGER_NAME:${cType}=${cValue}\n\n")
+
get_property(cHelpString CACHE EXTENDED_MEDIA_MODE PROPERTY HELPSTRING)
get_property(cType CACHE EXTENDED_MEDIA_MODE PROPERTY TYPE)
get_property(cValue CACHE EXTENDED_MEDIA_MODE PROPERTY VALUE)
@@ -376,6 +388,14 @@ else()
set(POLICY_MOCK_INCLUDE_PATH ${COMPONENTS_DIR}/include/test/policy/policy_regular/)
endif()
+if(${LOGGER_NAME} STREQUAL "LOG4CXX")
+ add_definitions(-DLOG4CXX_LOGGER)
+ message(STATUS "Selected the apache log4cxx logging library")
+else()
+ add_definitions(-DBOOST_LOGGER)
+ message(STATUS "Selected the boost logging library")
+endif()
+
# TODO(AK): check current OS here
add_definitions(-DOS_POSIX)
@@ -419,7 +439,8 @@ include_directories(
add_subdirectory(./src/3rd_party EXCLUDE_FROM_ALL)
find_package(OpenSSL REQUIRED)
-if(ENABLE_LOG)
+if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX")
+ message(STATUS "Including log4cxx")
include_directories ( ${LOG4CXX_INCLUDE_DIRECTORY} )
endif()