Define wrt-installer log format
authorsung-su.kim <sung-su.kim@samsung.com>
Wed, 11 Sep 2013 12:02:57 +0000 (21:02 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Wed, 11 Sep 2013 13:41:50 +0000 (22:41 +0900)
[Issue]    N/A
[Problem]  N/A
[Cause]    Change wrt-installer log form C++ style to C style
[Solution] Define wrt-installer log format using wrt-commons log format.
            - LogDebug/LogError/LogWarning to _D, _E, _W
            - Error log color change to red.
            - Define macro for type change from DPL::String to char*

[SCMRequest] N/A

Change-Id: I1b585b4a93cfaa9ea38da11f5f9fc4860ec0d5d3

CMakeLists.txt
src/commons/installer_log.h [new file with mode: 0644]

index 22515de..24143a2 100644 (file)
@@ -94,6 +94,7 @@ ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (need
 ADD_DEFINITIONS("-Wno-deprecated")      # No warnings about deprecated features
 ADD_DEFINITIONS("-std=c++0x")           # accept C++11x standard
 ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")  # enable smack
+ADD_DEFINITIONS("-DWRT_INSTALLER_LOG")  # enable installer log
 
 ############################# Targets names ###################################
 
diff --git a/src/commons/installer_log.h b/src/commons/installer_log.h
new file mode 100644 (file)
index 0000000..fab5b44
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013 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       installer_log.h
+ * @author     Sungsu Kim(sung-su.kim@samsung.com)
+ * @version    0.1
+ * @brief
+ */
+
+#ifndef INSTALLER_LOG_H
+#define INSTALLER_LOG_H
+
+#include <dlog.h>
+#include <dpl/log/secure_log.h>
+#include <dpl/string.h>
+
+#ifdef WRT_INSTALLER_LOG
+
+#undef COLOR_WARNING
+#define COLOR_WARNING "\e[0m"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[0m"
+
+#endif
+
+#define DPLToChar(DS) { DPL::ToUTF8String(DS).c_str() }
+
+#endif // INSTALLER_LOG_H
+