fix merge duplication
[platform/core/uifw/stt.git] / common / stt_dlog.h
1 /*
2 *  Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
3 *  Licensed under the Apache License, Version 2.0 (the "License");
4 *  you may not use this file except in compliance with the License.
5 *  You may obtain a copy of the License at
6 *  http://www.apache.org/licenses/LICENSE-2.0
7 *  Unless required by applicable law or agreed to in writing, software
8 *  distributed under the License is distributed on an "AS IS" BASIS,
9 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 *  See the License for the specific language governing permissions and
11 *  limitations under the License.
12 */
13
14 #ifndef __STT_DLOG_H__
15 #define __STT_DLOG_H__
16
17 #include <dlog.h>
18
19 #ifdef LOG_TAG
20 #undef LOG_TAG
21 #endif
22
23 #define LOG_TAG LOG_TAG_STT
24
25 #define COLOR_RED       "\033[0;31m"
26 #define COLOR_GREEN     "\033[0;32m"
27 #define COLOR_BROWN     "\033[0;33m"
28 #define COLOR_BLUE      "\033[0;34m"
29 #define COLOR_PURPLE    "\033[0;35m"
30 #define COLOR_CYAN      "\033[0;36m"
31 #define COLOR_LIGHTBLUE "\033[0;37m"
32 #define COLOR_END       "\033[0;m"
33
34 #define PLOG(fmt, args...) LOGD(fmt, ##args)
35 #define PINFO(fmt, args...) LOGI(COLOR_PURPLE fmt COLOR_END, ##args)
36 #define PWARNING(fmt, args...) LOGW(COLOR_BLUE fmt COLOR_END, ##args)
37 #define PERR(fmt, args...) LOGE(COLOR_RED fmt COLOR_END, ##args)
38 #define PENTER() LOGD(COLOR_GREEN "BEGIN >>>>" COLOR_END)
39 #define PLEAVE() LOGD(COLOR_GREEN "END <<<<" COLOR_END)
40
41 #define RET_IF(expr) \
42 do { \
43         if (expr) \
44                 return; \
45 } while (0)
46
47 #define RETV_IF(expr, val) \
48 do { \
49         if (expr) \
50                 return (val); \
51 } while (0)
52
53 #define RETM_IF(expr, fmt, arg...) \
54 do { \
55         if (expr) { \
56                 PERR(fmt, ##arg); \
57                 return; \
58         } \
59 } while (0)
60
61 #define RETVM_IF(expr, val, fmt, arg...) \
62 do { \
63         if (expr) { \
64                 PERR(fmt, ##arg); \
65                 return (val); \
66         } \
67 } while (0)
68
69 #endif /* __STT_DLOG_H__ */