summaryrefslogtreecommitdiffstats
path: root/src/include/_OverrideLog.h
blob: 065e271639630f2031197f43e64b077f4d0afbea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/******************************************************************************
 *
 *  Copyright (C) 2012 Broadcom Corporation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/

/******************************************************************************
 *
 *  Override the Android logging macro(s) from
 *  /system/core/include/cutils/log.h. This header must be the first header
 *  included by a *.cpp file so the original Android macro can be replaced.
 *  Do not include this header in another header, because that will create
 *  unnecessary dependency.
 *
 ******************************************************************************/
#pragma once

// Override Android's ALOGD macro by adding a boolean expression.
#define ALOGD(...) \
  ((void)ALOGD_IF(appl_trace_level >= BT_TRACE_LEVEL_DEBUG, __VA_ARGS__))

#include <cutils/log.h>  //define Android logging macros
#include "bt_types.h"

#ifdef __cplusplus
extern "C" {
#endif

extern unsigned char appl_trace_level;
extern uint32_t ScrProtocolTraceFlag;

/*******************************************************************************
**
** Function:        initializeGlobalAppLogLevel
**
** Description:     Initialize and get global logging level from .conf or
**                  Android property nfc.app_log_level.  The Android property
**                  overrides .conf variable.
**
** Returns:         Global log level:
**                  BT_TRACE_LEVEL_NONE    0 * No trace messages to be generated
**                  BT_TRACE_LEVEL_ERROR   1 * Error condition trace messages
**                  BT_TRACE_LEVEL_WARNING 2 * Warning condition trace messages
**                  BT_TRACE_LEVEL_API     3 * API traces
**                  BT_TRACE_LEVEL_EVENT   4 * Debug messages for events
**                  BT_TRACE_LEVEL_DEBUG   5 * Debug messages (general)
**
*******************************************************************************/
unsigned char initializeGlobalAppLogLevel();
uint32_t initializeProtocolLogLevel();

#ifdef __cplusplus
}
#endif