Add logger with klay to AppCustomTrustAnchor 35/109935/3
authorsangwan.kwon <sangwan.kwon@samsung.com>
Thu, 12 Jan 2017 07:33:55 +0000 (16:33 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Tue, 31 Jan 2017 06:39:21 +0000 (15:39 +0900)
Change-Id: I1e41f5909cdad827ca6eb6b16fec765601b23dfe
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
packaging/cert-svc.spec
src/transec/CMakeLists.txt
src/transec/InitLib.cpp [new file with mode: 0644]

index f65e7d9..6256640 100644 (file)
@@ -12,6 +12,7 @@ BuildRequires: coreutils
 BuildRequires: findutils
 BuildRequires: openssl
 BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(klay)
 BuildRequires: pkgconfig(openssl)
 BuildRequires: pkgconfig(libpcrecpp)
 BuildRequires: pkgconfig(xmlsec1)
index 36d751b..2cdc685 100644 (file)
 # @author      Sangwan Kwon (sangwan.kwon@samsung.com)
 # @breif       Make trasnport security library
 #
+PKG_CHECK_MODULES(${TARGET_TRANSEC_LIB}_DEP
+       REQUIRED
+               klay
+)
+
 SET(${TARGET_TRANSEC_LIB}_SRCS
+       InitLib.cpp
        AppCustomTrustAnchor.cpp
 )
 
@@ -36,6 +42,9 @@ SET_TARGET_PROPERTIES(${TARGET_TRANSEC_LIB}
                VERSION ${VERSION}
 )
 
+TARGET_LINK_LIBRARIES(${TARGET_TRANSEC_LIB}
+       ${${TARGET_TRANSEC_LIB}_DEP_LIBRARIES}
+)
 INSTALL(TARGETS ${TARGET_TRANSEC_LIB} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(FILES
                        AppCustomTrustAnchor.h
diff --git a/src/transec/InitLib.cpp b/src/transec/InitLib.cpp
new file mode 100644 (file)
index 0000000..2e31105
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file        InitLib.cpp
+ * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
+ * @version     0.1
+ * @brief       Init global configuration for library
+ */
+
+#include <klay/audit/logger.h>
+#include <klay/audit/dlog-sink.h>
+
+#include <memory>
+
+namespace transec {
+namespace {
+
+class InitLib {
+public:
+       InitLib()
+       {
+               audit::Logger::setBackend(new audit::DlogLogSink());
+               audit::Logger::setTag("CERT_SVC");
+       };
+       ~InitLib() = default;
+};
+
+static std::unique_ptr<InitLib> init(new(std::nothrow)(InitLib));
+
+} // namespace anonymous
+} // namespace transec