54d7d01104570496a3c921d3e512163a490596fb
[platform/core/multimedia/libmm-wfd.git] / common / include / mm_wfd_sink_dlog.h
1 /*
2 * Copyright (c) 2011 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 __MM_WFD_SINK_DLOG_H__
18 #define __MM_WFD_SINK_DLOG_H__
19
20 #include <dlog.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 #ifdef LOG_TAG
27 #undef LOG_TAG
28 #endif
29 #define LOG_TAG "MM_WFD_SINK"
30
31 #define FONT_COLOR_RESET    "\033[0m"
32 #define FONT_COLOR_RED      "\033[31m"
33 #define FONT_COLOR_GREEN    "\033[32m"
34 #define FONT_COLOR_YELLOW   "\033[33m"
35 #define FONT_COLOR_BLUE     "\033[34m"
36 #define FONT_COLOR_PURPLE   "\033[35m"
37 #define FONT_COLOR_CYAN     "\033[36m"
38 #define FONT_COLOR_GRAY     "\033[37m"
39
40 #define wfd_sink_debug(fmt, arg...) do { \
41                         LOGD(FONT_COLOR_RESET""fmt"", ##arg);     \
42                 } while (0)
43
44 #define wfd_sink_info(fmt, arg...) do { \
45                         LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg);     \
46                 } while (0)
47
48 #define wfd_sink_error(fmt, arg...) do { \
49                         LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg);     \
50                 } while (0)
51
52 #define wfd_sink_warning(fmt, arg...) do { \
53                         LOGW(FONT_COLOR_YELLOW""fmt""FONT_COLOR_RESET, ##arg);     \
54                 } while (0)
55
56 #define wfd_sink_debug_fenter() do { \
57                         LOGD(FONT_COLOR_RESET"<Enter>");     \
58                 } while (0)
59
60 #define wfd_sink_debug_fleave() do { \
61                         LOGD(FONT_COLOR_RESET"<Leave>");     \
62                 } while (0)
63
64 #define wfd_sink_error_fenter() do { \
65                         LOGE(FONT_COLOR_RESET"NO-ERROR : <Enter>");     \
66                 } while (0)
67
68 #define wfd_sink_error_fleave() do { \
69                         LOGE(FONT_COLOR_RESET"NO-ERROR : <Leave>");     \
70                 } while (0)
71
72 #define wfd_sink_sucure_info(fmt, arg...) do { \
73                         SECURE_LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg);     \
74                 } while (0)
75
76 #define wfd_sink_return_if_fail(expr)   \
77                 if(!(expr)) {   \
78                         wfd_sink_error(FONT_COLOR_RED"failed [%s]\n"FONT_COLOR_RESET, #expr);   \
79                         return; \
80                 }
81
82 #define wfd_sink_return_val_if_fail(expr, val)  \
83                 if (!(expr)) {  \
84                         wfd_sink_error(FONT_COLOR_RED"failed [%s]\n"FONT_COLOR_RESET, #expr);   \
85                         return val; \
86                 }
87
88 #define wfd_sink_assert_not_reached() \
89         { \
90                 wfd_sink_error(FONT_COLOR_RED"assert_not_reached()"FONT_COLOR_RESET); \
91                 assert(0); \
92         }
93
94
95 #ifdef __cplusplus
96 }
97 #endif /* __cplusplus */
98
99 #endif /* __MM_WFD_SINK_DLOG_H__ */
100