4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Haejeong Kim <backto.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef _MMFILE_DEBUG_H_
23 #define _MMFILE_DEBUG_H_
35 #define LOG_TAG "MM_FILEINFO"
39 #ifdef __MMFILE_TEST_MODE__
45 /*#define LOG_COLOR */
48 #define FONT_COLOR_RESET "\033[0m"
49 #define FONT_COLOR_RED "\033[31m"
50 #define FONT_COLOR_GREEN "\033[32m"
51 #define FONT_COLOR_YELLOW "\033[33m"
52 #define FONT_COLOR_BLUE "\033[34m"
53 #define FONT_COLOR_PURPLE "\033[35m"
54 #define FONT_COLOR_CYAN "\033[36m"
55 #define FONT_COLOR_GRAY "\033[37m"
57 #define debug_log(mode, fmt, arg...) do { \
58 if (mode == DEBUG) { \
59 LOGD(FONT_COLOR_RESET fmt, ##arg); \
60 } else if (mode == RELEASE) { \
61 if (DEBUG_MODE == 1) \
62 LOGD(FONT_COLOR_RESET fmt, ##arg); \
66 #define debug_msg(mode, fmt, arg...) do { \
67 if (mode == DEBUG) { \
68 LOGD(FONT_COLOR_RESET fmt, ##arg); \
69 } else if (mode == RELEASE) { \
70 if (DEBUG_MODE == 1) \
71 LOGD(FONT_COLOR_RESET fmt, ##arg); \
75 #define debug_warning(mode, fmt, arg...) do { \
76 if (mode == DEBUG) { \
77 LOGW(FONT_COLOR_GREEN fmt, ##arg); \
78 } else if (mode == RELEASE) { \
79 if (DEBUG_MODE == 1) \
80 LOGW(FONT_COLOR_GREEN fmt, ##arg); \
84 #define debug_error(mode, fmt, arg...) do { \
85 if (mode == DEBUG) { \
86 LOGE(FONT_COLOR_RED fmt, ##arg); \
87 } else if (mode == RELEASE) { \
88 if (DEBUG_MODE == 1) \
89 LOGE(FONT_COLOR_RED fmt, ##arg); \
93 #define debug_fenter(mode) do { \
94 if (mode == DEBUG) { \
95 LOGE(FONT_COLOR_RESET "<ENTER> \n"); \
96 } else if (mode == RELEASE) { \
97 if (DEBUG_MODE == 1) \
98 LOGE(FONT_COLOR_RESET "<ENTER> \n"); \
102 #define debug_fleave(mode) do { \
103 if (mode == DEBUG) { \
104 LOGE(FONT_COLOR_RESET "<LEAVE> \n"); \
105 } else if (mode == RELEASE) { \
106 if (DEBUG_MODE == 1) \
107 LOGE(FONT_COLOR_RESET "<LEAVE> \n"); \
113 #define debug_log(mode, fmt, arg...) do { \
114 if (mode == DEBUG) { \
115 LOGD(" "fmt"", ##arg); \
116 } else if (mode == RELEASE) { \
117 if (DEBUG_MODE == 1) \
118 LOGD(" "fmt"", ##arg); \
122 #define debug_msg(mode, fmt, arg...) do { \
123 if (mode == DEBUG) { \
124 LOGD(" "fmt"", ##arg); \
125 } else if (mode == RELEASE) { \
126 if (DEBUG_MODE == 1) \
127 LOGD(" "fmt"", ##arg); \
131 #define debug_warning(mode, fmt, arg...) do { \
132 if (mode == DEBUG) { \
133 LOGW(" "fmt"", ##arg); \
134 } else if (mode == RELEASE) { \
135 if (DEBUG_MODE == 1) \
136 LOGW(" "fmt"", ##arg); \
140 #define debug_error(mode, fmt, arg...) do { \
141 if (mode == DEBUG) { \
142 LOGE(" "fmt"", ##arg); \
143 } else if (mode == RELEASE) { \
144 if (DEBUG_MODE == 1) \
145 LOGE(" "fmt"", ##arg); \
149 #define debug_fenter(mode) do { \
150 if (mode == DEBUG) { \
151 LOGE("<ENTER> \n"); \
152 } else if (mode == RELEASE) { \
153 if (DEBUG_MODE == 1) \
154 LOGE("<ENTER> \n"); \
158 #define debug_fleave(mode) do { \
159 if (mode == DEBUG) { \
160 LOGE("<LEAVE> \n"); \
161 } else if (mode == RELEASE) { \
162 if (DEBUG_MODE == 1) \
163 LOGE("<LEAVE> \n"); \
168 #define mm_file_retv_if_fails(expr, val) do { \
174 #define mm_file_retvm_if_fails(mode, expr, val) do { \
176 debug_error(mode, "ERROR [%s]", #expr); \
185 #endif /* _MMFILE_DEBUG_H_ */