121a3b88fb34dfd5026a6b041b8870584b78eabf
[apps/native/volume-app.git] / src / _util_log.h
1  /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 __VOLUME_UTIL_LOG_H__
18 #define __VOLUME_UTIL_LOG_H__
19
20 #include <unistd.h>
21 #include <dlog.h>
22
23 #undef LOG_TAG
24 #define LOG_TAG "VOLUME"
25 #define _E(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
26 #define _D(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
27
28 #define retvm_if(expr, val, fmt, arg...) do { \
29         if(expr) { \
30                 _E(fmt, ##arg); \
31                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
32                 return (val); \
33         } \
34 } while (0)
35
36 #define retv_if(expr, val) do { \
37         if(expr) { \
38                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
39                 return (val); \
40         } \
41 } while (0)
42
43 #define retm_if(expr, fmt, arg...) do { \
44         if(expr) { \
45                 _E(fmt, ##arg); \
46                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
47                 return; \
48         } \
49 } while (0)
50
51 #define ret_if(expr) do { \
52         if(expr) { \
53                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
54                 return; \
55         } \
56 } while (0)
57
58
59 #endif                          /* __VOLUME_UTIL_LOG_H__ */