Remove support for DPL_USE_OLD_STYLE_* environment values in RELEASE build.
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 4 Sep 2013 09:52:33 +0000 (11:52 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 6 Feb 2014 16:13:22 +0000 (17:13 +0100)
This environment values will be supported in DEBUG build only:
 * DPL_USE_OLD_STYLE_LOGS
 * DPL_USE_OLD_STYLE_PEDANTIC_LOGS
 * DPL_USE_OLD_STYLE_LOGS_MASK

This commit turn off all logs except Error logs in RELEASE build.

[Issue#]   SSDWSSP-447
[Problem]  Security-server generates too many logs in RELEASE build.
           Debug logs may be turn on by environment values.
[Solution] Remove support for environment values.

[Verification] Successful build.

Change-Id: I557a69c007e4d916b2b2ac2f92e21572a9fb9f37

CMakeLists.txt
src/server2/dpl/log/include/dpl/log/log.h
src/server2/dpl/log/src/log.cpp

index a0b62e0..b0adb1c 100644 (file)
@@ -52,7 +52,11 @@ ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warni
 STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
 ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
 ADD_DEFINITIONS("-DSMACK_ENABLED")
-ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")           # Enable LOGS in security-server2
+
+IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
+    ADD_DEFINITIONS("-DTIZEN_ENGINEER_MODE")
+    ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
+ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
 
 SET(TARGET_SECURITY_SERVER "security-server")
 SET(TARGET_SECURITY_CLIENT "security-server-client")
index 2478d1f..0fee222 100644 (file)
@@ -172,36 +172,46 @@ typedef Singleton<LogSystem> LogSystemSingleton;
 //
 //
 
-#ifdef DPL_LOGS_ENABLED
-    #define DPL_MACRO_FOR_LOGGING(message, function)                           \
-    do                                                                     \
-    {                                                                      \
-        if (SecurityServer::Log::LogSystemSingleton::Instance().IsLoggingEnabled())   \
-        {                                                                  \
-            std::ostringstream platformLog;                                \
-            platformLog << message;                                        \
-            SecurityServer::Log::LogSystemSingleton::Instance().function(             \
-                platformLog.str().c_str(),                                 \
-                __FILE__, __LINE__, __FUNCTION__);                         \
-        }                                                                  \
-    } while (0)
-#else
 /* avoid warnings about unused variables */
-    #define DPL_MACRO_FOR_LOGGING(message, function)                           \
+#define DPL_MACRO_DUMMY_LOGGING(message, function)                         \
     do {                                                                   \
-        SecurityServer::Log::NullStream ns;                                           \
+        SecurityServer::Log::NullStream ns;                                \
         ns << message;                                                     \
     } while (0)
-#endif
 
-#define  LogDebug(message) DPL_MACRO_FOR_LOGGING(message, Debug)
-#define  LogInfo(message) DPL_MACRO_FOR_LOGGING(message, Info)
-#define  LogWarning(message) DPL_MACRO_FOR_LOGGING(message, Warning)
+#define DPL_MACRO_FOR_LOGGING(message, function)                           \
+do                                                                         \
+{                                                                          \
+    if (SecurityServer::Log::LogSystemSingleton::Instance().IsLoggingEnabled())   \
+    {                                                                      \
+        std::ostringstream platformLog;                                    \
+        platformLog << message;                                            \
+        SecurityServer::Log::LogSystemSingleton::Instance().function(      \
+            platformLog.str().c_str(),                                     \
+            __FILE__, __LINE__, __FUNCTION__);                             \
+    }                                                                      \
+} while (0)
+
+/* Errors must be always logged. */
 #define  LogError(message) DPL_MACRO_FOR_LOGGING(message, Error)
-#define  LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, Pedantic)
-#define  LogSecureDebug(message) DPL_MACRO_FOR_LOGGING(message, SecureDebug)
-#define  LogSecureInfo(message) DPL_MACRO_FOR_LOGGING(message, SecureInfo)
-#define  LogSecureWarning(message) DPL_MACRO_FOR_LOGGING(message, SecureWarning)
 #define  LogSecureError(message) DPL_MACRO_FOR_LOGGING(message, SecureError)
 
+#ifdef BUILD_TYPE_DEBUG
+    #define LogDebug(message) DPL_MACRO_FOR_LOGGING(message, Debug)
+    #define LogInfo(message) DPL_MACRO_FOR_LOGGING(message, Info)
+    #define LogWarning(message) DPL_MACRO_FOR_LOGGING(message, Warning)
+    #define LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, Pedantic)
+    #define LogSecureDebug(message) DPL_MACRO_FOR_LOGGING(message, SecureDebug)
+    #define LogSecureInfo(message) DPL_MACRO_FOR_LOGGING(message, SecureInfo)
+    #define LogSecureWarning(message) DPL_MACRO_FOR_LOGGING(message, SecureWarning)
+#else
+    #define LogDebug(message) DPL_MACRO_DUMMY_LOGGING(message, Debug)
+    #define LogInfo(message) DPL_MACRO_DUMMY_LOGGING(message, Info)
+    #define LogWarning(message) DPL_MACRO_DUMMY_LOGGING(message, Warning)
+    #define LogPedantic(message) DPL_MACRO_DUMMY_LOGGING(message, Pedantic)
+    #define LogSecureDebug(message) DPL_MACRO_DUMMY_LOGGING(message, SecureDebug)
+    #define LogSecureInfo(message) DPL_MACRO_DUMMY_LOGGING(message, SecureInfo)
+    #define LogSecureWarning(message) DPL_MACRO_DUMMY_LOGGING(message, SecureWarning)
+#endif // BUILD_TYPE_DEBUG
+
 #endif // SECURITYSERVER_LOG_H
index 13330b8..5903e4c 100644 (file)
@@ -31,10 +31,12 @@ namespace SecurityServer {
 namespace Log {
 namespace // anonymous
 {
+#ifdef BUILD_TYPE_DEBUG
 const char *OLD_STYLE_LOGS_ENV_NAME = "DPL_USE_OLD_STYLE_LOGS";
 const char *OLD_STYLE_PEDANTIC_LOGS_ENV_NAME =
     "DPL_USE_OLD_STYLE_PEDANTIC_LOGS";
 const char *OLD_STYLE_LOGS_MASK_ENV_NAME = "DPL_USE_OLD_STYLE_LOGS_MASK";
+#endif // BUILD_TYPE_DEBUG
 const char *SECURITY_SERVER_LOG_OFF = "DPL_LOG_OFF";
 } // namespace anonymous
 
@@ -48,6 +50,7 @@ LogSystem::LogSystem() :
     m_oldStyleProvider(NULL),
     m_isLoggingEnabled(!getenv(SECURITY_SERVER_LOG_OFF))
 {
+#ifdef BUILD_TYPE_DEBUG
     bool oldStyleLogs = false;
     bool oldStyleDebugLogs = true;
     bool oldStyleInfoLogs = true;
@@ -120,6 +123,10 @@ LogSystem::LogSystem() :
         m_dlogProvider = new DLOGLogProvider();
         AddProvider(m_dlogProvider);
     }
+#else // BUILD_TYPE_DEBUG
+    m_dlogProvider = new DLOGLogProvider();
+    AddProvider(m_dlogProvider);
+#endif // BUILD_TYPE_DEBUG
 }
 
 LogSystem::~LogSystem()