tizen beta release
[framework/location/gps-manager.git] / gps-manager / debug_util.h
1 /*
2  * gps-manager
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7  *          Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.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 _GPS_MANAGER_DEBUG_UTIL_H_
23 #define _GPS_MANAGER_DEBUG_UTIL_H_
24
25 #include <glib.h>
26 #include <libgen.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define GPS_MANAGER_DLOG
33 #define LBS_DLOG_DEBUG          // filename and line number will be shown
34
35 #ifdef GPS_MANAGER_DLOG
36 #include <dlog.h>
37 #define TAG_GPS_MANAGER      "gps-manager"
38
39 #define DBG_LOW         LOG_DEBUG
40 #define DBG_INFO        LOG_INFO
41 #define DBG_WARN        LOG_WARN
42 #define DBG_ERR         LOG_ERROR
43
44 #ifdef LBS_DLOG_DEBUG           // Debug mode
45 #define LOG_GPS(dbg_lvl,fmt,args...)  SLOG(dbg_lvl, TAG_GPS_MANAGER, "[%-24s: %-4d] "fmt, basename(__FILE__), __LINE__, ##args)
46 #define FUNC_ENTRANCE_SERVER         LOG_GPS(DBG_LOW, "[%s] Entered!!\n", __func__);
47 #else                           // Release(commercial) mode
48 #define LOG_GPS(dbg_lvl,fmt,args...)  SLOG(dbg_lvl, TAG_GPS_MANAGER, fmt, ##args)
49 #define FUNC_ENTRANCE_SERVER
50 #endif
51 #else                           // No dlog
52 #define LOG_GPS(dbg_lvl,fmt,args...)  g_debug("[%-24s: %-4d] "fmt, basename(__FILE__), __LINE__, ##args)
53 #define FUNC_ENTRANCE_SERVER         g_debug("[%s] Entered!!\n", __func__);
54 #endif
55
56 #ifdef __cplusplus
57 }
58 #endif
59 #endif                          /* _GPS_MANAGER_DEBUG_UTIL_H_ */