-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathdebug.h
35 lines (25 loc) · 1.04 KB
/
debug.h
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
// SPDX-License-Identifier: GPL-3.0-only
/*
* Copyright (c) 2023 Dengfeng Liu <[email protected]>
*/
#ifndef XFRPC_DEBUG_H
#define XFRPC_DEBUG_H
#include <string.h>
#include <syslog.h>
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
typedef struct _debug_conf {
int debuglevel; /**< @brief Debug information verbosity */
int log_stderr; /**< @brief Output log to stdout */
int log_syslog; /**< @brief Output log to syslog */
int syslog_facility; /**< @brief facility to use when using syslog for logging */
} debugconf_t;
extern debugconf_t debugconf;
/** Used to output messages.
* The messages will include the filename and line number, and will be sent to syslog if so configured in the config file
* @param level Debug level
* @param format... sprintf like format string
*/
#define debug(level, format...) _debug(__FILENAME__ , __LINE__, level, format)
/** @internal */
void _debug(const char *, int, int, const char *, ...);
#endif