File: bl_debug.h

package info (click to toggle)
mlterm 3.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,340 kB
  • sloc: ansic: 154,713; sh: 5,302; cpp: 2,953; objc: 2,776; java: 2,472; makefile: 2,445; perl: 1,674; xml: 44
file content (54 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (3)
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
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */

#ifndef __BL_DEBUG_H__
#define __BL_DEBUG_H__

#include "bl_def.h"
#include "bl_util.h" /* BL_INT_TO_STR */

#include <android/log.h>

/* for bl_{debug|warn}_printf */
#if 0

#ifdef CONCATABLE_FUNCTION
#define BL_DEBUG_TAG "[" __FUNCTION__ "()]"
#else
#define BL_DEBUG_TAG "[" __FILE__ "]"
#endif

#else

#define BL_DEBUG_TAG "[" __FILE__ ":" BL_INT_TO_STR(__LINE__) "]"

#endif

#ifdef BL_DEBUG

#define BL_TESTIT(func, args) TEST_##func args
#define BL_TESTIT_ONCE(func, args) \
  {                                \
    static int func##_tested;      \
    if (!func##_tested) {          \
      func##_tested = 1;           \
      TEST_##func args;            \
    }                              \
  }
#else

#define BL_TESTIT(func, args)
#define BL_TESTIT_ONCE(func, args)

#endif

#define bl_debug_printf(...) (__android_log_print(ANDROID_LOG_INFO, "", __VA_ARGS__) >= 0)

#define bl_warn_printf(...) (__android_log_print(ANDROID_LOG_WARN, "", __VA_ARGS__) >= 0)

#define bl_error_printf(...) (__android_log_print(ANDROID_LOG_ERROR, "", __VA_ARGS__) >= 0)

#define bl_msg_printf(...) (__android_log_print(ANDROID_LOG_INFO, "", __VA_ARGS__) >= 0)

#define bl_set_msg_log_file_name(name) (0)

#endif