File: debug.h

package info (click to toggle)
libopenobex 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 972 kB
  • ctags: 1,552
  • sloc: ansic: 9,988; xml: 407; makefile: 96
file content (43 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (2)
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
#ifndef OPENOBEX_DEBUG_H
#define OPENOBEX_DEBUG_H

#if defined(_MSC_VER) && _MSC_VER < 1400
void log_debug(char *format, ...);
#define log_debug_prefix ""

#elif defined(OBEX_SYSLOG) && !defined(_WIN32)
#include <syslog.h>
#define log_debug(format, ...) syslog(LOG_DEBUG, format, ## __VA_ARGS__)
#define log_debug_prefix "OpenOBEX: "

#else
#include <stdio.h>
#define log_debug(format, ...) fprintf(stderr, format, ## __VA_ARGS__)
#define log_debug_prefix ""
#endif

/* use integer:  0 for production
 *               1 for verification
 *              >2 for debug
 */
extern int obex_debug;

#if defined(_MSC_VER) && _MSC_VER < 1400
void DEBUG(int n, const char *format, ...);

#else
#  define DEBUG(n, format, ...) \
          if (obex_debug >= (n)) \
            log_debug("%s%s(): " format, log_debug_prefix, __FUNCTION__, ## __VA_ARGS__)
#endif


/* use bitmask: 0x1 for sendbuff
 *              0x2 for receivebuff
 */
extern int obex_dump;

#define DUMPBUFFER(n, label, msg) \
        if ((obex_dump & 0x3) & (n)) buf_dump(msg, label);

#endif