[Release] wrt-commons_0.2.145
[framework/web/wrt-commons.git] / modules / log / include / dpl / log / secure_log.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file       secure_log.h
18  * @author     Jihoon Chung(jihoon.chung@samsung.com)
19  * @version    0.1
20  * @brief
21  */
22
23 #ifndef DPL_SECURE_LOG_H
24 #define DPL_SECURE_LOG_H
25
26 #include <dlog.h>
27
28 #define COLOR_ERROR   "\e[1;31m"
29 #define COLOR_WARNING "\e[2;31m"
30 #define COLOR_END     "\e[0m"
31 #define COLOR_TAG     "\e[0m"
32
33 // default TAG
34 #undef LOG_TAG
35 #define LOG_TAG "WRT_UNDEFINED"
36
37 #ifdef WRT_LOG
38 #undef LOG_TAG
39 #define LOG_TAG "WRT"
40 #undef COLOR_TAG
41 #define COLOR_TAG "\e[1;32m"
42 #endif
43
44 #ifdef WRT_BUNDLE_LOG
45 #undef LOG_TAG
46 #define LOG_TAG "WRT_BUNDLE"
47 #undef COLOR_TAG
48 #define COLOR_TAG "\e[1;34m"
49 #endif
50
51 #ifdef WRT_PLUGINS_COMMON_LOG
52 #undef LOG_TAG
53 #define LOG_TAG "WRT_PLUGINS/COMMON"
54 #undef COLOR_TAG
55 #define COLOR_TAG "\e[1;36m"
56 #endif
57
58 #ifdef WRT_PLUGINS_WIDGET_LOG
59 #undef LOG_TAG
60 #define LOG_TAG "WRT_PLUGINS/WIDGET"
61 #undef COLOR_TAG
62 #define COLOR_TAG "\e[1;35m"
63 #endif
64
65 #ifdef WRT_INSTALLER_LOG
66 #undef LOG_TAG
67 #define LOG_TAG "WRT_INSTALLER"
68 #undef COLOR_TAG
69 #define COLOR_TAG "\e[1;32m"
70 #endif
71
72 #ifndef SECURE_SLOGD
73 #define SECURE_SLOGD(fmt, arg...) SLOGD(fmt,##arg)
74 #endif
75
76 #ifndef SECURE_SLOGW
77 #define SECURE_SLOGW(fmt, arg...) SLOGW(fmt,##arg)
78 #endif
79
80 #ifndef SECURE_SLOGE
81 #define SECURE_SLOGE(fmt, arg...) SLOGE(fmt,##arg)
82 #endif
83
84 #define _D(fmt, arg ...) SECURE_SLOGD(COLOR_TAG fmt COLOR_END,##arg)
85 #define _W(fmt, arg ...) SECURE_SLOGW(COLOR_WARNING fmt COLOR_END,##arg)
86 #define _E(fmt, arg ...) SECURE_SLOGE(COLOR_ERROR fmt COLOR_END,##arg)
87
88 #endif // DPL_SECURE_LOG_H
89