summaryrefslogtreecommitdiffstats
path: root/third_party/sipcc/sdp_log.h
blob: 6aeb1215298f4350e4c263961dfd500f642b3d89 (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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* This is a mirror of CSFLog. The implementations of SDPLog, SDPLogV, and
   SDPLogTestLevel must be provided by the user. */

#ifndef SDPLOG_H
#define SDPLOG_H

#include <stdarg.h>

typedef enum {
  SDP_LOG_ERROR = 1,
  SDP_LOG_WARNING,
  SDP_LOG_INFO,
  SDP_LOG_DEBUG,
  SDP_LOG_VERBOSE,
} SDPLogLevel;

#define SDPLogError(tag, format, ...) \
  SDPLog(SDP_LOG_ERROR, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogErrorV(tag, format, va_list_arg) \
  SDPLogV(SDP_LOG_ERROR, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogWarn(tag, format, ...) \
  SDPLog(SDP_LOG_WARNING, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogWarnV(tag, format, va_list_arg) \
  SDPLogV(SDP_LOG_WARNING, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogInfo(tag, format, ...) \
  SDPLog(SDP_LOG_INFO, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogInfoV(tag, format, va_list_arg) \
  SDPLogV(SDP_LOG_INFO, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogDebug(tag, format, ...) \
  SDPLog(SDP_LOG_DEBUG, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogDebugV(tag, format, va_list_arg) \
  SDPLogV(SDP_LOG_DEBUG, __FILE__, __LINE__, tag, format, va_list_arg)
#define SDPLogVerbose(tag, format, ...) \
  SDPLog(SDP_LOG_VERBOSE, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
#define SDPLogVerboseV(tag, format, va_list_arg) \
  SDPLogV(SDP_LOG_VERBOSE, __FILE__, __LINE__, tag, format, va_list_arg)

#ifdef __cplusplus
extern "C" {
#endif
void SDPLog(SDPLogLevel priority, const char* sourceFile, int sourceLine,
            const char* tag, const char* format, ...)

#ifdef __GNUC__
    __attribute__((format(printf, 5, 6)))
#endif
    ;

void SDPLogV(SDPLogLevel priority, const char* sourceFile, int sourceLine,
             const char* tag, const char* format, va_list args);

int SDPLogTestLevel(SDPLogLevel priority);

#ifdef __cplusplus
}
#endif

#endif