SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
SET(CMAKE_SKIP_RPATH "TRUE")
-IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
-ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
-ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
-ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
-
# compiler warning flags
ADD_DEFINITIONS("-Wall")
ADD_DEFINITIONS("-Wextra")
${VCORE_DIR}/vcore/Ocsp.cpp
${VCORE_DIR}/vcore/CryptoInit.cpp
${VCORE_DIR}/vcore/PluginHandler.cpp
+ ${VCORE_DIR}/vcore/init-lib.cpp
)
SET(VCORE_INCLUDES
} while (0)
-#ifdef BUILD_TYPE_DEBUG
+#ifdef TIZEN_ENGINEER_MODE
#define LogDebug(message) DPL_MACRO_FOR_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Debug)
#define LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Pedantic)
#else
#define LogDebug(message) DPL_MACRO_DUMMY_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Debug)
#define LogPedantic(message) DPL_MACRO_DUMMY_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Pedantic)
-#endif // BUILD_TYPE_DEBUG
+#endif // TIZEN_ENGINEER_MODE
#define LogInfo(message) DPL_MACRO_FOR_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Info)
#define LogWarning(message) DPL_MACRO_FOR_LOGGING(message, VcoreDPL::Log::AbstractLogProvider::LogLevel::Warning)
LogSystem::LogSystem()
: m_providerCtor({
-#ifdef BUILD_TYPE_DEBUG
+#ifdef TIZEN_ENGINEER_MODE
{ CONSOLE, []{ return static_cast<AbstractLogProvider *>(new OldStyleLogProvider()); }},
#endif
{ DLOG, []{ return static_cast<AbstractLogProvider *>(new DLOGLogProvider()); }},
try {
prv = m_providerCtor.at(getenv(CERTSVC_LOG_PROVIDER))();
} catch (const std::exception &) {
- prv = m_providerCtor[JOURNALD]();
+ prv = m_providerCtor[DLOG]();
}
AddProvider(prv);
void LogSystem::SetLogLevel(const char *level)
{
- try {
- m_level = static_cast<AbstractLogProvider::LogLevel>(std::stoi(level));
- } catch(const std::exception&) {
+ if (!level) {
m_level = AbstractLogProvider::LogLevel::Debug;
+ } else {
+ try {
+ m_level = static_cast<AbstractLogProvider::LogLevel>(std::stoi(level));
+ } catch(const std::exception&) {
+ m_level = AbstractLogProvider::LogLevel::Debug;
+ }
}
if (m_level < AbstractLogProvider::LogLevel::None)
else if (m_level > AbstractLogProvider::LogLevel::Pedantic)
m_level = AbstractLogProvider::LogLevel::Pedantic;
-#ifndef BUILD_TYPE_DEBUG
+#ifndef TIZEN_ENGINEER_MODE
if (m_level > AbstractLogProvider::LogLevel::Error)
m_level = AbstractLogProvider::LogLevel::Error;
-#endif // BUILD_TYPE_DEBUG
+#endif
}
void LogSystem::Log(AbstractLogProvider::LogLevel level,
--- /dev/null
+/*
+ * Copyright (c) 2016 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 init-lib.cpp
+ * @author Kyungwook Tak (k.tak@samsung.com)
+ * @version 1.0
+ * @brief init/deinit global configuration for library
+ */
+
+#include <dpl/log/log.h>
+
+__attribute__((constructor))
+static void init_lib(void)
+{
+ try {
+ VcoreDPL::Log::LogSystemSingleton::Instance().SetTag("CERT_SVC");
+ VcoreDPL::Log::LogSystemSingleton::Instance().SetLogLevel(nullptr);
+ } catch (...) {
+ LogError("Failed to init lib for initialize log system");
+ }
+}