tizen beta release
[platform/core/multimedia/avsystem.git] / include / avsys-debug.h
1 /*
2  * avsystem
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jonghyuk Choi <jhchoi.choi@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 the debug function of AV System.
24  *
25  * @file                avsys_debug.h
26  * @version     0.1
27  */
28
29 #ifndef __AVSYS_DEBUG_H__
30 #define __AVSYS_DEBUG_H__
31
32 #ifdef __USE_LOGMANAGER__
33 #include <stdio.h>
34 #include <mm_log.h>
35 #define AVAUDIO  LOG_AVAUDIO
36 #define AVVIDEO  LOG_AVVIDEO
37 #define AVCAMERA LOG_AVCAMERA
38 #else
39 #define AVAUDIO
40 #define AVVIDEO
41 #define AVCAMERA
42 #endif
43
44 #ifdef __DEBUG_MODE__
45 #ifdef __USE_LOGMANAGER__
46
47 #define avsys_info_r(owner, msg, args...)               log_print_rel( owner, LOG_CLASS_INFO,     "[%05d:%s] "msg, __LINE__, __func__, ##args )
48 #define avsys_warning_r(owner, msg, args...)    log_print_rel( owner, LOG_CLASS_WARNING,  "[%05d:%s] "msg, __LINE__, __func__, ##args )
49 #define avsys_error_r(owner, msg, args...)              log_print_rel( owner, LOG_CLASS_ERR,      "[%05d:%s] "msg, __LINE__, __func__, ##args )
50 #define avsys_critical_r(owner, msg, args...)   log_print_rel( owner, LOG_CLASS_CRITICAL, "[%05d:%s] "msg, __LINE__, __func__, ##args )
51 #define avsys_assert_r(condition)                               log_assert_rel(( condition ))
52
53 #define avsys_info(owner, msg, args...)                 log_print_dbg( owner, LOG_CLASS_INFO,     "[%05d:%s] "msg, __LINE__, __func__, ##args )
54 #define avsys_warning(owner, msg, args...)              log_print_dbg( owner, LOG_CLASS_WARNING,  "[%05d:%s] "msg, __LINE__, __func__, ##args )
55 #define avsys_error(owner, msg, args...)                log_print_dbg( owner, LOG_CLASS_ERR,      "[%05d:%s] "msg, __LINE__, __func__, ##args )
56 #define avsys_critical(owner, msg, args...)             log_print_dbg( owner, LOG_CLASS_CRITICAL, "[%05d:%s] "msg, __LINE__, __func__, ##args )
57 #define avsys_assert(condition)                                 log_assert_dbg( (condition) )
58
59 #else   /* __USE_LOGMANAGER__ */
60
61 #define avsys_info_r(owner, msg, args...)               fprintf(stderr, msg, ##args)
62 #define avsys_warning_r(owner, msg, args...)    fprintf(stderr, msg, ##args)
63 #define avsys_error_r(owner, msg, args...)              fprintf(stderr, msg, ##args)
64 #define avsys_critical_r(owner, msg, args...)   fprintf(stderr, msg, ##args)
65 #define avsys_assert_r(condition)                               (condition)
66
67 #define avsys_info(owner, msg, args...)                 fprintf(stderr, msg, ##args)
68 #define avsys_warning(owner, msg, args...)              fprintf(stderr, msg, ##args)
69 #define avsys_error(owner, msg, args...)                fprintf(stderr, msg, ##args)
70 #define avsys_critical(owner, msg, args...)             fprintf(stderr, msg, ##args)
71 #define avsys_assert(condition)                                 (condition)
72
73 #endif  /* __USE_LOGMANAGER__ */
74
75 #else   /* __DEBUG_MODE__ */
76
77 #define avsys_info_r(owner, msg, args...)
78 #define avsys_warning_r(owner, msg, args...)
79 #define avsys_error_r(owner, msg, args...)
80 #define avsys_critical_r(owner, msg, args...)
81 #define avsys_assert_r(condition)                               (condition)
82
83 #define avsys_info(owner, msg, args...)
84 #define avsys_warning(owner, msg, args...)
85 #define avsys_error(owner, msg, args...)
86 #define avsys_critical(owner, msg, args...)
87 #define avsys_assert(condition)                                 (condition)
88
89 #endif  /* __DEBUG_MODE__ */
90
91 #endif /* __AVSYS_DEBUG_H__ */