Pushed latest libmedia-service for tizen beta
[framework/multimedia/libmedia-service.git] / src / include / visual / media-svc-debug.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 /** 
23  * This file defines synchronize apis for phone explorer.
24  *
25  * @file        media-svc-debug.h
26  * @author              Hyunjun Ko <zzoon.ko@samsung.com>
27  * @version     1.0
28  * @brief       This file defines in-house apis for media service.
29  */
30
31  
32  /**
33   * @ingroup MEDIA_SVC
34   * @defgroup MEDIA_SVC_DEBUG in-house media service API
35   * @{
36   */
37
38
39
40 #ifndef _MEDIA_SVC_DEBUG_H_
41 #define _MEDIA_SVC_DEBUG_H_
42
43
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <dlog.h>
47
48
49
50 #ifdef LOG_TAG
51 #undef LOG_TAG
52 #endif
53
54 #define LOG_TAG "Media-SVC"
55
56 #ifndef DEBUG_PREFIX
57 #define DEBUG_PREFIX "Media-SVC"
58 #endif
59
60 //#define MB_SVC_LOG_FILE  "/opt/mb-svc.log"
61
62 #define MB_DEBUG
63
64 #ifdef MB_DEBUG
65
66
67 #ifndef LOG_TAG
68
69
70 #ifdef MB_SVC_LOG_FILE
71 #define pb_svc_debug(fmt, arg...)       \
72         {       \
73                 FILE *fp;       \
74                 fp = fopen(MB_SVC_LOG_FILE, "a");       \
75                 fprintf(fp, "[%s] ", DEBUG_PREFIX);     \
76                 fprintf(fp, fmt, ##arg);        \
77                 fclose(fp);     \
78                 fprintf(stderr, "[%s] ", DEBUG_PREFIX); \
79                 fprintf(stderr, fmt, ##arg);    \
80         }
81
82 #else /*MB_SVC_LOG_FILE*/
83 #define mb_svc_debug(fmt, arg...)       \
84 {       \
85         fprintf(stderr, "[%s] ", DEBUG_PREFIX); \
86         fprintf(stderr, fmt, ##arg);    \
87 }
88 #endif /*MB_SVC_LOG_FILE*/
89
90
91 #else /*LOG_TAG*/
92 #include <unistd.h>
93 #include <asm/unistd.h>
94 #include <pthread.h>
95 static pid_t gettid(void)
96 {
97         return syscall(__NR_gettid);
98 }
99
100 #define mb_svc_debug(fmt, arg...)        LOGD("[%d] [%s : %d] " fmt "\n", gettid(), __FUNCTION__, __LINE__, ##arg)
101
102
103
104 #endif /*LOG_TAG*/
105
106 #else /*MB_DEBUG*/
107
108 #define mb_svc_debug(fmt, arg...)
109
110 #endif /*MB_DEBUG*/
111
112 #endif /*_MEDIA_SVC_DEBUG_H_*/
113
114 /**
115 * @}
116 */
117
118