summaryrefslogtreecommitdiff
path: root/src/xlog.h
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2015-02-04 10:05:27 -0500
committerSteve Dickson <steved@redhat.com>2015-02-05 10:18:42 -0500
commit6b7d70a8a57d0a68f473ab6b245cd4ae2dd672e8 (patch)
tree51d4cacf895fc80576a4ec7a1afcbb58d5b579c9 /src/xlog.h
parent95cb04e539a74dbf53e87a13c291389a3e6d4f1d (diff)
downloadrpcbind-6b7d70a8a57d0a68f473ab6b245cd4ae2dd672e8.tar.gz
rpcbind: Introduce the xlog logging code
To improve rpcbind's debugging the xlog code from the nfs-utils package has been ported. Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'src/xlog.h')
-rw-r--r--src/xlog.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/xlog.h b/src/xlog.h
new file mode 100644
index 0000000..a57b96c
--- /dev/null
+++ b/src/xlog.h
@@ -0,0 +1,52 @@
+/*
+ * xlog Logging functionality
+ *
+ * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
+ */
+
+#ifndef XLOG_H
+#define XLOG_H
+
+#include <stdarg.h>
+
+/* These are logged always. L_FATAL also does exit(1) */
+#define L_FATAL 0x0100
+#define L_ERROR 0x0200
+#define L_WARNING 0x0400
+#define L_NOTICE 0x0800
+#define L_ALL 0xFF00
+
+/* These are logged if enabled with xlog_[s]config */
+/* NB: code does not expect ORing together D_ and L_ */
+#define D_GENERAL 0x0001 /* general debug info */
+#define D_CALL 0x0002
+#define D_AUTH 0x0004
+#define D_FAC3 0x0008
+#define D_FAC4 0x0010
+#define D_FAC5 0x0020
+#define D_PARSE 0x0040
+#define D_FAC7 0x0080
+#define D_ALL 0x00FF
+
+/* This can be used to define symbolic log names that can be passed to
+ * xlog_config.
+ */
+struct xlog_debugfac {
+ char *df_name;
+ int df_fac;
+};
+
+extern int export_errno;
+void xlog_open(char *progname);
+void xlog_stderr(int on);
+void xlog_syslog(int on);
+void xlog_config(int fac, int on);
+void xlog_sconfig(char *, int on);
+int xlog_enabled(int fac);
+void xlog(int fac, const char *fmt, ...);
+void xlog_warn(const char *fmt, ...);
+void xlog_err(const char *fmt, ...);
+void xlog_errno(int err, const char *fmt, ...);
+void xlog_backend(int fac, const char *fmt, va_list args);
+
+#endif /* XLOG_H */