Add secure log
authorJihoon Chung <jihoon.chung@samsaung.com>
Wed, 28 Aug 2013 04:48:48 +0000 (13:48 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Wed, 28 Aug 2013 06:56:15 +0000 (15:56 +0900)
[Issue#]   N/A
[Problem]  Unused build flag is added.
           Also, log isn't showed in the source code.
[Cause]    wrt-setting menu isn't managed quite long time.
           As new UX is confirmed and setting menu is reopened,
           wrt-setting needs to use secure_log.
[Solution] Update build flag to show log.
           - Enable "-DTIZEN_ENGINEER_MODE".
             This build option is mandatory to show log in the ENG system binary.
             In case of ENG system binary, log checks "-DTIZEN_ENGINEER_MODE" build option.
           - Add secure log define in the wrt-setting git.
             It is quite unfair to use "dpl/secure_log.h".
             Because "dpl/secure_log.h" uses platform level log define.
             As wrt-setting is application level, add independent log define in the "util.h".
[SCMRequest] N/A

Conflicts:
packaging/wrt-setting.spec
webapp-detail/util.h

Change-Id: I9fb033be99f736eed25e1497b453a0e31a48c4a0

packaging/wrt-setting.spec
webapp-detail/ug.cpp
webapp-detail/util.h

index 8fb242a..c9a2855 100755 (executable)
@@ -32,7 +32,8 @@ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 %endif
 
 export LDFLAGS+="-Wl,--rpath=/usr/lib"
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPROJECT_VERSION=%{version} -DPROJECT_API_VERSION=%{version}
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DUG_INSTALL_PREFIX=/usr -DPROJECT_API_VERSION=0 -DPROJECT_VERSION=%{version}
+
 make %{?jobs:-j%jobs}
 
 %install
index 31927cb..90c69c6 100755 (executable)
@@ -27,6 +27,7 @@
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
 #include "mainview.h"
+#include "util.h"
 
 #define EXPORT_SYMBOL extern "C" __attribute__((visibility("default")))
 
@@ -39,6 +40,7 @@ static void *onCreate(ui_gadget_h ug,
                       service_h service,
                       void *user_data)
 {
+    _D("called");
     struct priv *priv;
     WrtDB::TizenAppId appID;
     char *pkgname = NULL;
@@ -66,6 +68,7 @@ static void onDestroy(ui_gadget_h /*ug*/,
                       service_h /*service*/,
                       void *user_data)
 {
+    _D("called");
     struct priv *priv;
 
     Assert(user_data);
@@ -76,6 +79,7 @@ static void onDestroy(ui_gadget_h /*ug*/,
 
 EXPORT_SYMBOL int UG_MODULE_INIT(struct ug_module_ops *ops)
 {
+    _D("called");
     struct priv *priv;
 
     Assert(ops);
@@ -97,6 +101,7 @@ EXPORT_SYMBOL int UG_MODULE_INIT(struct ug_module_ops *ops)
 
 EXPORT_SYMBOL void UG_MODULE_EXIT(struct ug_module_ops *ops)
 {
+    _D("called");
     struct priv *priv;
 
     Assert(ops);
index 6e2c1fa..b8d3508 100755 (executable)
   * limitations under the License.
   */
 
-#ifndef WEB_SRC_SETTING_WEBAPP_DETAIL_UTIL_H_ 
+#ifndef WEB_SRC_SETTING_WEBAPP_DETAIL_UTIL_H_
 #define WEB_SRC_SETTING_WEBAPP_DETAIL_UTIL_H_
 
+#include <dlog.h>
 #include <libintl.h>
 
 #define D_(str) dgettext("sys_string", str)
 #define U_(str) dgettext("ug-webapp-detail-efl", str)
 
 #define UNUSED_PARAM(expr) (void)(expr)
+#define COLOR_ERROR   "\e[1;31m"
+#define COLOR_WARNING "\e[2;31m"
+#define COLOR_TAG     "\e[1;32m"
+#define COLOR_END     "\e[0m"
+
+#undef LOG_TAG
+#define LOG_TAG "WRT-SETTING"
+
+#ifndef SECURE_LOGD
+#define SECURE_LOGD(fmt, arg...) LOGD(fmt,##arg)
+#endif
+
+#ifndef SECURE_LOGW
+#define SECURE_LOGW(fmt, arg...) LOGW(fmt,##arg)
+#endif
+
+#ifndef SECURE_LOGE
+#define SECURE_LOGE(fmt, arg...) LOGE(fmt,##arg)
+#endif
+
+#define _D(fmt, arg ...) SECURE_LOGD(COLOR_TAG fmt COLOR_END,##arg)
+#define _W(fmt, arg ...) SECURE_LOGW(COLOR_WARNING fmt COLOR_END,##arg)
+#define _E(fmt, arg ...) SECURE_LOGE(COLOR_ERROR fmt COLOR_END,##arg)
 
 #endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_UTIL_H_ */