Code sync from tizen_2.4
[platform/core/telephony/tel-plugin-indicator.git] / include / s_indi_log.h
1 /*
2  * tel-plugin-indicator
3  *
4  * Copyright (c) 2014 Samsung Electronics Co. Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #pragma once
20
21 #include <tcore.h>
22
23 enum {
24         MODEM_ID_PRIMARY,
25         MODEM_ID_SECONDARY
26 };
27
28 #define MODEM_ID_FIRST  MODEM_ID_PRIMARY
29 #define MODEM_ID_LAST  MODEM_ID_SECONDARY
30
31 #ifdef FEATURE_LOG_MODE_VERBOSE
32 #define s_indi_log_v(...) dbg(__VA_ARGS__)
33 #else
34 #define s_indi_log_v(...) \
35         do { \
36         } while (0)
37 #endif
38
39 #ifdef FEATURE_LOG_TX_RX_DATA
40 #define s_indi_log_txrx(id,...) \
41         do { \
42                 const char *tag = s_indi_get_log_tag_with_id(id); \
43                 info_ex(tag, __VA_ARGS__); \
44         } while (0)
45 #else
46 #define s_indi_log_txrx(id,...) \
47         do { \
48         } while (0)
49 #endif
50
51 #define s_indi_log_ex(name,...) \
52         do { \
53                 gchar *tag = s_indi_get_log_tag_with_cp_name(name); \
54                 dbg_ex(tag, __VA_ARGS__); \
55                 g_free(tag); \
56         } while (0)
57
58 inline const char *s_indi_get_log_tag_with_id(unsigned int modem_id);
59 inline char *s_indi_get_log_tag_with_cp_name(const char *cp_name);