android_logmsg.cpp revision 26620e3108f6a0f32f5f0a0725e28e5ae66017d6
1/****************************************************************************
2**
3**  Name:       android_logmsg.cpp
4**
5**  Function    This file contains helper functions for android logging
6**
7**  Copyright (c) 2011-2012, Broadcom Corp., All Rights Reserved.
8**  Broadcom Bluetooth Core. Proprietary and confidential.
9**
10*****************************************************************************/
11#include "buildcfg.h"
12#include <cutils/log.h>
13
14
15#ifndef BTE_LOG_BUF_SIZE
16    #define BTE_LOG_BUF_SIZE  1024
17#endif
18#define BTE_LOG_MAX_SIZE  (BTE_LOG_BUF_SIZE - 12)
19
20
21extern "C"
22{
23    void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
24}
25
26/*******************************************************************************
27**
28** Function:    ScrLog
29**
30** Description: log a message
31**
32** Returns:     none
33**
34*******************************************************************************/
35void ScrLog (UINT32 trace_set_mask, const char *fmt_str, ...)
36{
37    static char buffer[BTE_LOG_BUF_SIZE];
38    va_list ap;
39
40    va_start(ap, fmt_str);
41    vsnprintf(buffer, BTE_LOG_MAX_SIZE, fmt_str, ap);
42    va_end(ap);
43    __android_log_write(ANDROID_LOG_INFO, "BrcmNci", buffer);
44}
45
46
47/*******************************************************************************
48**
49** Function:    LogMsg
50**
51** Description: log a message
52**
53** Returns:     none
54**
55*******************************************************************************/
56void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...)
57{
58    static char buffer[BTE_LOG_BUF_SIZE];
59    va_list ap;
60
61    va_start(ap, fmt_str);
62    vsnprintf(buffer, BTE_LOG_MAX_SIZE, fmt_str, ap);
63    va_end(ap);
64    __android_log_write(ANDROID_LOG_INFO, "BrcmNfcNfa", buffer);
65}
66
67