[Release] wrt-commons_0.2.139
[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 #ifdef WRT_LOG
34 #undef LOG_TAG
35 #define LOG_TAG "WRT"
36 #undef COLOR_TAG
37 #define COLOR_TAG "\e[1;32m"
38 #endif
39
40 #ifdef WRT_BUNDLE_LOG
41 #undef LOG_TAG
42 #define LOG_TAG "WRT_BUNDLE"
43 #undef COLOR_TAG
44 #define COLOR_TAG "\e[1;34m"
45 #endif
46
47 #ifdef WRT_PLUGINS_COMMON_LOG
48 #undef LOG_TAG
49 #define LOG_TAG "WRT_PLUGINS/COMMON"
50 #undef COLOR_TAG
51 #define COLOR_TAG "\e[1;36m"
52 #endif
53
54 #ifdef WRT_PLUGINS_WIDGET_LOG
55 #undef LOG_TAG
56 #define LOG_TAG "WRT_PLUGINS/WIDGET"
57 #undef COLOR_TAG
58 #define COLOR_TAG "\e[1;35m"
59 #endif
60
61 #ifdef WRT_INSTALLER_LOG
62 #undef LOG_TAG
63 #define LOG_TAG "WRT_INSTALLER"
64 #undef COLOR_TAG
65 #define COLOR_TAG "\e[1;32m"
66 #endif
67
68 #ifndef SECURE_SLOGD
69 #define SECURE_SLOGD(fmt, arg...) SLOGD(fmt,##arg)
70 #endif
71
72 #ifndef SECURE_SLOGW
73 #define SECURE_SLOGW(fmt, arg...) SLOGW(fmt,##arg)
74 #endif
75
76 #ifndef SECURE_SLOGE
77 #define SECURE_SLOGE(fmt, arg...) SLOGE(fmt,##arg)
78 #endif
79
80 #define _D(fmt, arg ...) SECURE_SLOGD(COLOR_TAG fmt COLOR_END,##arg)
81 #define _W(fmt, arg ...) SECURE_SLOGW(COLOR_WARNING fmt COLOR_END,##arg)
82 #define _E(fmt, arg ...) SECURE_SLOGE(COLOR_ERROR fmt COLOR_END,##arg)
83
84 #endif // DPL_SECURE_LOG_H
85