diff options
author | sangwan.kwon <sangwan.kwon@samsung.com> | 2016-05-11 16:11:41 +0900 |
---|---|---|
committer | sangwan.kwon <sangwan.kwon@samsung.com> | 2016-05-12 11:25:29 +0900 |
commit | 89b9a4436daf8adc56eeb9396f718af418d660f0 (patch) | |
tree | bae16ab1c0d8c04bb22c7e80a8cd4c06b9102cce | |
parent | 93a4383419a348cb773f638776062648b5dc71d2 (diff) | |
download | cert-checker-89b9a4436daf8adc56eeb9396f718af418d660f0.tar.gz cert-checker-89b9a4436daf8adc56eeb9396f718af418d660f0.tar.bz2 cert-checker-89b9a4436daf8adc56eeb9396f718af418d660f0.zip |
Move log system to common library
Change-Id: I313b4b4d6019cca575996f7f3fd3f3254f4ce11a
35 files changed, 44 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2145fd2..7bd3e63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,6 @@ SET(TARGET_CERT_CHECKER_POPUP_TEST "${SERVICE_NAME}-popup-test") # Define global macro about PATH SET(CERT_CHECKER_SRC_PATH ${PROJECT_SOURCE_DIR}/src) SET(CERT_CHECKER_SERVICE_PATH ${CERT_CHECKER_SRC_PATH}/service) -SET(CERT_CHECKER_LOG_PATH ${CERT_CHECKER_SRC_PATH}/log) SET(CERT_CHECKER_UI_PATH ${CERT_CHECKER_SRC_PATH}/ui) SET(CERT_CHECKER_DB_PATH ${CERT_CHECKER_SRC_PATH}/db) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 420b5ff..7e6ee57 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,6 @@ PKG_CHECK_MODULES(${TARGET_CERT_CHECKER}_DEP gio-2.0 icu-i18n key-manager - libsystemd-journal libsystemd-daemon sqlite3 pkgmgr @@ -46,7 +45,6 @@ SET(${TARGET_CERT_CHECKER}_SRCS ${CERT_CHECKER_SERVICE_PATH}/queue.cpp ${CERT_CHECKER_SERVICE_PATH}/certs.cpp ${CERT_CHECKER_SERVICE_PATH}/ocsp-service.cpp - ${CERT_CHECKER_LOG_PATH}/log.cpp ${CERT_CHECKER_DB_PATH}/sql_query.cpp ${CERT_CHECKER_UI_PATH}/UIBackend.cpp ${CERT_CHECKER_UI_PATH}/popup-runner.cpp @@ -71,7 +69,7 @@ INCLUDE_DIRECTORIES(SYSTEM SET_SOURCE_FILES_PROPERTIES(${${TARGET_CERT_CHECKER}_SRCS} PROPERTIES - COMPILE_FLAGS "-D_GNU_SOURCE -fPIE -fvisibility=default" + COMPILE_FLAGS "-D_GNU_SOURCE -fPIE" ) ADD_EXECUTABLE(${TARGET_CERT_CHECKER} ${${TARGET_CERT_CHECKER}_SRCS}) diff --git a/src/client/ocsp-client.cpp b/src/client/ocsp-client.cpp index 77484fc..c805715 100644 --- a/src/client/ocsp-client.cpp +++ b/src/client/ocsp-client.cpp @@ -23,7 +23,7 @@ #include "client/error.h" #include "common/command-id.h" -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { namespace Client { diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index dcd149d..4cc3754 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -31,6 +31,7 @@ SET(${TARGET_CERT_CHECKER_COMMON}_SRCS ${COMMON_PATH}/mainloop.cpp ${COMMON_PATH}/service.cpp ${COMMON_PATH}/socket.cpp + ${COMMON_PATH}/log.cpp ) INCLUDE_DIRECTORIES(SYSTEM diff --git a/src/log/log.cpp b/src/common/log.cpp index ced0fe9..c5528a2 100644 --- a/src/log/log.cpp +++ b/src/common/log.cpp @@ -18,6 +18,7 @@ * @author Janusz Kozerski <j.kozerski@samsung.com> * @brief This file declares class for ask user window */ +#include "common/log.h" #include <stdexcept> #include <systemd/sd-journal.h> diff --git a/src/include/cchecker/log.h b/src/common/log.h index d4efcdc..99d494b 100644 --- a/src/include/cchecker/log.h +++ b/src/common/log.h @@ -62,24 +62,21 @@ do \ __FUNCTION__); \ } while (0) -/* Errors must be always logged. */ +/* always logged. */ #define LogError(message) \ CERT_CHECKER_LOG(message, LOG_ERR) +#define LogInfo(message) \ + CERT_CHECKER_LOG(message, LOG_INFO) +#define LogWarning(message) \ + CERT_CHECKER_LOG(message, LOG_WARNING) +/* only debug logged. */ #ifdef BUILD_TYPE_DEBUG #define LogDebug(message) \ CERT_CHECKER_LOG(message, LOG_DEBUG) - #define LogInfo(message) \ - CERT_CHECKER_LOG(message, LOG_INFO) - #define LogWarning(message) \ - CERT_CHECKER_LOG(message, LOG_WARNING) #else #define LogDebug(message) \ DPL_MACRO_DUMMY_LOGGING(message, LOG_DEBUG) - #define LogInfo(message) \ - DPL_MACRO_DUMMY_LOGGING(message, LOG_INFO) - #define LogWarning(message) \ - DPL_MACRO_DUMMY_LOGGING(message, LOG_WARNING) #endif // BUILD_TYPE_DEBUG #endif //CERT_CHECKER_LOG_H diff --git a/src/common/mainloop.cpp b/src/common/mainloop.cpp index 19ff477..4e0f7dd 100644 --- a/src/common/mainloop.cpp +++ b/src/common/mainloop.cpp @@ -27,7 +27,7 @@ #include <sys/epoll.h> #include <unistd.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { diff --git a/src/common/service.cpp b/src/common/service.cpp index 49f2408..6f3c46c 100644 --- a/src/common/service.cpp +++ b/src/common/service.cpp @@ -25,7 +25,7 @@ #include <sys/types.h> #include <sys/epoll.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 30c2edc..05ed75f 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -31,7 +31,7 @@ #include <systemd/sd-daemon.h> -#include <cchecker/log.h> +#include "common/log.h" namespace { diff --git a/src/db/sql_query.cpp b/src/db/sql_query.cpp index 800c144..bafbf56 100644 --- a/src/db/sql_query.cpp +++ b/src/db/sql_query.cpp @@ -22,7 +22,7 @@ #include <cchecker/dpl/db/sql_connection.h> #include <cchecker/sql_query.h> -#include <cchecker/log.h> +#include "common/log.h" namespace { diff --git a/src/dpl/core/src/assert.cpp b/src/dpl/core/src/assert.cpp index 2050617..e367562 100644 --- a/src/dpl/core/src/assert.cpp +++ b/src/dpl/core/src/assert.cpp @@ -24,7 +24,7 @@ #include <cchecker/dpl/assert.h> #include <cchecker/dpl/exception.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { void AssertProc(const char *condition, diff --git a/src/dpl/core/src/exception.cpp b/src/dpl/core/src/exception.cpp index d26e13c..bee161b 100644 --- a/src/dpl/core/src/exception.cpp +++ b/src/dpl/core/src/exception.cpp @@ -23,7 +23,7 @@ #include <cstdio> #include <cchecker/dpl/exception.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { Exception* Exception::m_lastException = NULL; diff --git a/src/dpl/core/src/string.cpp b/src/dpl/core/src/string.cpp index 3e1028e..7c8223d 100644 --- a/src/dpl/core/src/string.cpp +++ b/src/dpl/core/src/string.cpp @@ -33,7 +33,7 @@ #include <cchecker/dpl/errno_string.h> #include <cchecker/dpl/exception.h> #include <cchecker/dpl/scoped_array.h> -#include <cchecker/log.h> +#include "common/log.h" // TODO: Completely move to ICU namespace CCHECKER { diff --git a/src/dpl/db/include/cchecker/dpl/db/sql_connection.h b/src/dpl/db/include/cchecker/dpl/db/sql_connection.h index 8af5a58..d3612ce 100644 --- a/src/dpl/db/include/cchecker/dpl/db/sql_connection.h +++ b/src/dpl/db/include/cchecker/dpl/db/sql_connection.h @@ -33,7 +33,7 @@ #include <cchecker/dpl/noncopyable.h> #include <cchecker/dpl/exception.h> #include <cchecker/dpl/optional.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { namespace DB { diff --git a/src/dpl/db/src/sql_connection.cpp b/src/dpl/db/src/sql_connection.cpp index 65c04ec..4bee5de 100644 --- a/src/dpl/db/src/sql_connection.cpp +++ b/src/dpl/db/src/sql_connection.cpp @@ -31,6 +31,8 @@ #include <cchecker/dpl/db/sql_connection.h> #include <cchecker/dpl/db/naive_synchronization_object.h> +#include "common/log.h" + namespace CCHECKER { namespace DB { namespace // anonymous diff --git a/src/main/cert-checker.cpp b/src/main/cert-checker.cpp index e4cdb44..389d37a 100644 --- a/src/main/cert-checker.cpp +++ b/src/main/cert-checker.cpp @@ -22,7 +22,7 @@ #include <glib.h> -#include <cchecker/log.h> +#include "common/log.h" #include "service/logic.h" #include "service/ocsp-service.h" diff --git a/src/service/app.cpp b/src/service/app.cpp index a61f4a3..c35bc73 100644 --- a/src/service/app.cpp +++ b/src/service/app.cpp @@ -25,7 +25,7 @@ #include <string> #include <sys/types.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { diff --git a/src/service/certs.cpp b/src/service/certs.cpp index 248b867..c06fe6f 100644 --- a/src/service/certs.cpp +++ b/src/service/certs.cpp @@ -33,7 +33,7 @@ #include <ckm/ckm-type.h> #include <ckm/ckm-raw-buffer.h> -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { diff --git a/src/service/logic.cpp b/src/service/logic.cpp index f0ebaee..538c2e7 100644 --- a/src/service/logic.cpp +++ b/src/service/logic.cpp @@ -25,7 +25,7 @@ #include <stdexcept> #include <set> -#include <cchecker/log.h> +#include "common/log.h" #include <cchecker/sql_query.h> #include <cchecker/UIBackend.h> diff --git a/src/service/ocsp-service.cpp b/src/service/ocsp-service.cpp index 8743de2..63a3c0a 100644 --- a/src/service/ocsp-service.cpp +++ b/src/service/ocsp-service.cpp @@ -22,7 +22,7 @@ #include "service/ocsp-service.h" #include "common/command-id.h" -#include <cchecker/log.h> +#include "common/log.h" namespace CCHECKER { diff --git a/src/ui/UIBackend.cpp b/src/ui/UIBackend.cpp index accac7c..bb15e34 100644 --- a/src/ui/UIBackend.cpp +++ b/src/ui/UIBackend.cpp @@ -21,7 +21,7 @@ #include <app_control.h> -#include <cchecker/log.h> +#include "common/log.h" #include <cchecker/UIBackend.h> #include <cchecker/popup-runner.h> diff --git a/src/ui/popup-bin/CMakeLists.txt b/src/ui/popup-bin/CMakeLists.txt index 285653a..a9e7e14 100644 --- a/src/ui/popup-bin/CMakeLists.txt +++ b/src/ui/popup-bin/CMakeLists.txt @@ -21,7 +21,6 @@ PKG_CHECK_MODULES(CERT_CHECKER_POPUP_DEP elementary - libsystemd-journal libtzplatform-config REQUIRED) @@ -31,8 +30,6 @@ set(CERT_CHECKER_POPUP_SOURCES ${CERT_CHECKER_POPUP_SRC_DIR}/popup.cpp ${CERT_CHECKER_UI_PATH}/popup-runner.cpp ${CERT_CHECKER_SERVICE_PATH}/app.cpp - # logs - ${CERT_CHECKER_LOG_PATH}/log.cpp # dpl ${DPL_CORE_SRC_PATH}/assert.cpp ${DPL_CORE_SRC_PATH}/exception.cpp @@ -46,6 +43,7 @@ ADD_DEFINITIONS(${CERT_CHECKER_POPUP_DEP_CFLAGS}) INCLUDE_DIRECTORIES( ${CERT_CHECKER_POPUP_SRC_DIR} ${CERT_CHECKER_POPUP_DEP_INCLUDE_DIRS} + ${CERT_CHECKER_SRC_PATH} ${CERT_CHECKER_SRC_PATH}/include/ ${DPL_CORE_SRC_PATH}/include/ ) @@ -61,6 +59,7 @@ SET_TARGET_PROPERTIES(${TARGET_CERT_CHECKER_POPUP} PROPERTIES TARGET_LINK_LIBRARIES(${TARGET_CERT_CHECKER_POPUP} ${CERT_CHECKER_POPUP_DEP_LIBRARIES} + ${TARGET_CERT_CHECKER_COMMON} -pie ) diff --git a/src/ui/popup-bin/popup.cpp b/src/ui/popup-bin/popup.cpp index f616907..b9381af 100644 --- a/src/ui/popup-bin/popup.cpp +++ b/src/ui/popup-bin/popup.cpp @@ -31,7 +31,7 @@ #include <Elementary.h> #include <popup.h> -#include <cchecker/log.h> +#include "common/log.h" #include <cchecker/UIBackend.h> #include <cchecker/popup-runner.h> #include <cchecker/dpl/serialization.h> diff --git a/src/ui/popup-runner.cpp b/src/ui/popup-runner.cpp index bae75e8..31e3e8f 100644 --- a/src/ui/popup-runner.cpp +++ b/src/ui/popup-runner.cpp @@ -31,7 +31,7 @@ #include "service/app.h" #include "service/logic.h" -#include <cchecker/log.h> +#include "common/log.h" #include <cchecker/UIBackend.h> #include <cchecker/popup-runner.h> diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ff25260..651072c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,7 +9,6 @@ PKG_CHECK_MODULES(CERT_CHECKER_TESTS_DEP gio-2.0 icu-i18n key-manager - libsystemd-journal sqlite3 pkgmgr pkgmgr-info @@ -37,8 +36,6 @@ SET(CERT_CHECKER_TESTS_SOURCES ${CERT_CHECKER_SERVICE_PATH}/app.cpp ${CERT_CHECKER_SERVICE_PATH}/queue.cpp ${CERT_CHECKER_SERVICE_PATH}/certs.cpp - # logs - ${CERT_CHECKER_LOG_PATH}/log.cpp # dpl ${DPL_CORE_SRC_PATH}/assert.cpp ${DPL_CORE_SRC_PATH}/char_traits.cpp @@ -65,8 +62,6 @@ SET(CERT_CHECKER_TESTS_LOGIC_SOURCES ${CERT_CHECKER_SERVICE_PATH}/logic.cpp ${CERT_CHECKER_SERVICE_PATH}/app.cpp ${CERT_CHECKER_SERVICE_PATH}/queue.cpp - # logs - ${CERT_CHECKER_LOG_PATH}/log.cpp # dpl ${DPL_CORE_SRC_PATH}/colors.cpp ) @@ -78,8 +73,6 @@ SET(CERT_CHECKER_POPUP_TEST_SOURCES ${CERT_CHECKER_SERVICE_PATH}/app.cpp ${CERT_CHECKER_UI_PATH}/popup-runner.cpp ${CERT_CHECKER_UI_PATH}/UIBackend.cpp - # logs - ${CERT_CHECKER_LOG_PATH}/log.cpp ) INCLUDE_DIRECTORIES(SYSTEM diff --git a/tests/app_event_operators.cpp b/tests/app_event_operators.cpp index 6fb2c2e..131e511 100644 --- a/tests/app_event_operators.cpp +++ b/tests/app_event_operators.cpp @@ -20,7 +20,7 @@ * @brief Implementation of app_test class (from app_t) */ -#include <cchecker/log.h> +#include "common/log.h" #include <app_event_operators.h> //using namespace CCHECKER; diff --git a/tests/logic_.cpp b/tests/logic_.cpp index 0259bd6..5679b96 100644 --- a/tests/logic_.cpp +++ b/tests/logic_.cpp @@ -25,7 +25,7 @@ * Some of methods are stubbed, and some of them just calls corresponding methods from Logic Class. */ -#include <cchecker/log.h> +#include "common/log.h" #include <chrono> #include <boost/test/unit_test.hpp> diff --git a/tests/main.cpp b/tests/main.cpp index 5ac4ab5..8fe6733 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -25,7 +25,8 @@ #include <boost/test/results_reporter.hpp> #include <colour_log_formatter.h> -#include <cchecker/log.h> + +#include "common/log.h" struct TestConfig { TestConfig() { diff --git a/tests/popup_test.cpp b/tests/popup_test.cpp index d08747e..3f6676d 100644 --- a/tests/popup_test.cpp +++ b/tests/popup_test.cpp @@ -21,7 +21,8 @@ */ #include <cchecker/UIBackend.h> -#include <cchecker/log.h> + +#include "common/log.h" using namespace CCHECKER; diff --git a/tests/queue_test_thread.cpp b/tests/queue_test_thread.cpp index b553dde..b98ddc1 100644 --- a/tests/queue_test_thread.cpp +++ b/tests/queue_test_thread.cpp @@ -25,7 +25,7 @@ #include "service/app.h" #include "service/queue.h" -#include <cchecker/log.h> +#include "common/log.h" #include <queue_test_thread.h> diff --git a/tests/test_app.cpp b/tests/test_app.cpp index 295d724..c32d571 100644 --- a/tests/test_app.cpp +++ b/tests/test_app.cpp @@ -23,7 +23,7 @@ #include <boost/test/unit_test.hpp> #include <string> -#include <cchecker/log.h> +#include "common/log.h" #include <app_event_operators.h> using namespace CCHECKER; diff --git a/tests/test_certs.cpp b/tests/test_certs.cpp index b206ead..e9f5b34 100644 --- a/tests/test_certs.cpp +++ b/tests/test_certs.cpp @@ -24,7 +24,7 @@ #include <string> #include <thread> -#include <cchecker/log.h> +#include "common/log.h" #include <certs_.h> #include <app_event_operators.h> diff --git a/tests/test_db.cpp b/tests/test_db.cpp index 31e7bf6..9649087 100644 --- a/tests/test_db.cpp +++ b/tests/test_db.cpp @@ -24,10 +24,11 @@ #include <boost/test/unit_test.hpp> #include <string> -#include <cchecker/log.h> #include <dbfixture.h> #include <app_event_operators.h> +#include "common/log.h" + BOOST_FIXTURE_TEST_SUITE(DB_TEST, DBFixture) BOOST_AUTO_TEST_CASE(DB_app_positive) { diff --git a/tests/test_logic.cpp b/tests/test_logic.cpp index 5ddbd8c..08f1af1 100644 --- a/tests/test_logic.cpp +++ b/tests/test_logic.cpp @@ -25,12 +25,11 @@ #include <string> #include <unistd.h> -#include <cchecker/log.h> - #include <logic_.h> #include <app_event_operators.h> #include "client/ocsp-client.h" +#include "common/log.h" using namespace CCHECKER; diff --git a/tests/test_queue.cpp b/tests/test_queue.cpp index 384d6e4..dd1f51e 100644 --- a/tests/test_queue.cpp +++ b/tests/test_queue.cpp @@ -24,10 +24,11 @@ #include <string> #include <thread> -#include <cchecker/log.h> #include <queue_test_thread.h> #include <app_event_operators.h> +#include "common/log.h" + using namespace CCHECKER; BOOST_FIXTURE_TEST_SUITE(QUEUE_TEST, Queue) |