aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/debug.h')
-rw-r--r--networking/udhcp/debug.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/networking/udhcp/debug.h b/networking/udhcp/debug.h
new file mode 100644
index 000000000..a1e197412
--- /dev/null
+++ b/networking/udhcp/debug.h
@@ -0,0 +1,41 @@
1#ifndef _DEBUG_H
2#define _DEBUG_H
3
4#include "libbb_udhcp.h"
5
6#include <stdio.h>
7#ifdef SYSLOG
8#include <syslog.h>
9#endif
10
11
12#ifdef SYSLOG
13# define LOG(level, str, args...) do { printf(str, ## args); \
14 printf("\n"); \
15 syslog(level, str, ## args); } while(0)
16# define OPEN_LOG(name) openlog(name, 0, 0)
17#define CLOSE_LOG() closelog()
18#else
19# define LOG_EMERG "EMERGENCY!"
20# define LOG_ALERT "ALERT!"
21# define LOG_CRIT "critical!"
22# define LOG_WARNING "warning"
23# define LOG_ERR "error"
24# define LOG_INFO "info"
25# define LOG_DEBUG "debug"
26# define LOG(level, str, args...) do { printf("%s, ", level); \
27 printf(str, ## args); \
28 printf("\n"); } while(0)
29# define OPEN_LOG(name) do {;} while(0)
30#define CLOSE_LOG() do {;} while(0)
31#endif
32
33#ifdef DEBUG
34# undef DEBUG
35# define DEBUG(level, str, args...) LOG(level, str, ## args)
36# define DEBUGGING
37#else
38# define DEBUG(level, str, args...) do {;} while(0)
39#endif
40
41#endif