1. Change tag style for error log
[platform/core/location/lbs-location.git] / location / include / location-log.h
1 /*
2  * libslp-location
3  *
4  * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
7  *                                      Genie Kim <daejins.kim@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 #ifndef __LOCATION_LOG_H__
23 #define __LOCATION_LOG_H__
24
25 /**
26  * @file location-log.h
27  * @brief This file contains macro functions for logging.
28  */
29
30 /* Tag defines */
31 #define TAG_LOCATION_FWK "LOCATION"
32
33 #include <dlog.h>
34 #ifdef LOG_TAG
35 #undef LOG_TAG
36 #define LOG_TAG TAG_LOCATION_FWK
37 #endif
38
39 #define LOCATION_LOGD(fmt, args...)             LOGD(fmt, ##args)
40 #define LOCATION_LOGW(fmt, args...)             LOGW(fmt, ##args)
41 #define LOCATION_LOGI(fmt, args...)             LOGI(fmt, ##args)
42 #define LOCATION_LOGE(fmt, args...)             LOGE(fmt, ##args)
43 #define LOCATION_SECLOG(fmt, args...)   SECURE_LOGD(fmt, ##args)
44
45 #define _D(fmt, args...)                LOGD(fmt, ##args)
46 #define _W(fmt, args...)                LOGW(fmt, ##args)
47 #define _I(fmt, args...)                LOGI(fmt, ##args)
48 #define _E(fmt, args...)                LOGE(fmt, ##args)
49
50 #define LOC_IF_FAIL(ret, tag, fmt, arg...) \
51         do { if (ret != 0) { tag(fmt, ##arg); return ret; } } while (0)
52
53 #define LOC_IF_FAIL_LOG(ret, tag, fmt, arg...) \
54         do { if (ret != 0) tag(fmt, ##arg); } while (0)
55
56 #define LOC_COND_RET(cond, ret, tag, fmt, arg...) \
57         do { if (cond) { tag(fmt, ##arg); return ret; } } while (0)
58
59 #define LOC_COND_VOID(cond, tag, fmt, arg...) \
60         do { if (cond) { tag(fmt, ##arg); return ; } } while (0)
61
62 #define LOC_COND_LOG(cond, tag, fmt, arg...) \
63         do { if (cond) tag(fmt, ##arg); } while (0)
64
65 #define LOC_FUNC_LOG            LOGI("%s", __func__);
66
67 #endif