Update Tizen 2.4 latest codes
[platform/core/security/cert-svc.git] / vcore / src / dpl / log / include / dpl / log / vcore_log.h
1 /*
2  * Copyright (c) 2014 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 #ifndef VCORE_LOG_H
18 #define VCORE_LOG_H
19
20 #ifdef LOG_TAG
21 #undef LOG_TAG
22 #endif
23 #define LOG_TAG "CERT_SVC_VCORE"
24
25 #include <dlog.h>
26
27 #define COLOR_ERROR   "\033[38;5;160;1m" // bold red
28 #define COLOR_WARNING "\033[38;5;202;1m" // bold orange
29 #define COLOR_INFO    "\033[38;5;243;1m" // bold light gray
30 #define COLOR_DEBUG   "\033[38;5;243;0m" // normal light gray
31 #define COLOR_END     "\033[0m"
32
33 #define INTERNAL_SECURE_LOG __extension__ SECURE_SLOG
34 #define VCORE_LOG(priority, color, format, ...) \
35 do { \
36     INTERNAL_SECURE_LOG(priority, LOG_TAG, color format "%s", __VA_ARGS__); \
37 } while(0)
38
39
40 /*
41  * Please use following macros
42  */
43 #define VcoreLogD(...) VCORE_LOG(LOG_DEBUG, COLOR_DEBUG, __VA_ARGS__, COLOR_END)
44 #define VcoreLogI(...) VCORE_LOG(LOG_INFO, COLOR_INFO, __VA_ARGS__, COLOR_END)
45 #define VcoreLogW(...) VCORE_LOG(LOG_WARN, COLOR_WARNING, __VA_ARGS__, COLOR_END)
46 #define VcoreLogE(...) VCORE_LOG(LOG_ERROR, COLOR_ERROR, __VA_ARGS__, COLOR_END)
47
48 #endif