merge with master
[framework/multimedia/audio-session-manager.git] / include / asm-log.h
1 /*
2  * audio-session-manager
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@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 #ifndef __ASM_LOG_H__
23 #define __ASM_LOG_H__
24
25 #ifdef __DEBUG_MODE__
26 #include <stdio.h>
27
28 #ifdef __USE_LOGMANAGER__
29 #include <dlog.h>
30
31 #define LOG_TAG "MMFW_SESSIONMGR"
32 #define asm_info(fmt, arg...) SLOG(LOG_VERBOSE, LOG_TAG, "<DEBUG> [%s:%d] "fmt"", __FUNCTION__,__LINE__,##arg)
33 #define asm_warning(fmt, arg...) SLOG(LOG_WARN, LOG_TAG, "<WARNI> [%s:%d] "fmt"", __FUNCTION__,__LINE__,##arg)
34 #define asm_error(fmt, arg...) SLOG(LOG_ERROR, LOG_TAG, "<ERROR> [%s:%d] "fmt"", __FUNCTION__,__LINE__,##arg)
35 #define asm_critical(fmt, arg...) SLOG(LOG_ERROR, LOG_TAG, "<FATAL> [%s:%d] "fmt"", __FUNCTION__,__LINE__,##arg)
36 #define asm_fenter()    SLOG(LOG_VERBOSE, LOG_TAG, "<ENTER> [%s:%d]", __FUNCTION__,__LINE__)
37 #define asm_fleave()    SLOG(LOG_VERBOSE, LOG_TAG, "<LEAVE> [%s:%d]", __FUNCTION__,__LINE__)
38
39 #else   //__USE_LOGMANAGER__
40
41 #define asm_info_r(msg, args...) fprintf(stderr, msg, ##args)
42 #define asm_warning_r(msg, args...) fprintf(stderr, msg, ##args)
43 #define asm_error_r(msg, args...) fprintf(stderr, msg, ##args)
44 #define asm_critical_r(msg, args...) fprintf(stderr, msg, ##args)
45 #define asm_assert_r(condition)         (condition)
46
47 #define asm_info(msg, args...) fprintf(stderr, msg, ##args)
48 #define asm_warning(msg, args...) fprintf(stderr, msg, ##args)
49 #define asm_error(msg, args...) fprintf(stderr, msg, ##args)
50 #define asm_critical(msg, args...) fprintf(stderr, msg, ##args)
51 #define asm_assert(condition)                   (condition)
52 #define asm_fenter()
53 #define asm_fleave()
54
55 #endif  //__USE_LOGMANAGER__
56
57 #else   //__DEBUG_MODE__
58
59 #define asm_info_r(msg, args...)
60 #define asm_warning_r(msg, args...)
61 #define asm_error_r(msg, args...)
62 #define asm_critical_r(msg, args...)
63 #define asm_assert_r(condition) (condition)
64
65 #define asm_info(msg, args...)
66 #define asm_warning(msg, args...)
67 #define asm_error(msg, args...)
68 #define asm_critical(msg, args...)
69 #define asm_assert(condition)           (condition)
70 #define asm_fenter()
71 #define asm_fleave()
72
73 #endif  // __DEBUG_MODE__
74
75 #endif  /* __ASM_LOG_H__ */