summaryrefslogtreecommitdiffstats
path: root/pcilib/debug.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
commit8da61292f595c5e700a4fef981b0e0d07910b4b2 (patch)
treea012e6312d95d50c3e8bd58bc972dbccdd3bd0bf /pcilib/debug.c
parenta740fcee56bd456a759e03526df476e1791fb2bd (diff)
downloadpcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.gz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.bz2
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.xz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.zip
Provide an interface for logging debug messages
Diffstat (limited to 'pcilib/debug.c')
-rw-r--r--pcilib/debug.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/pcilib/debug.c b/pcilib/debug.c
new file mode 100644
index 0000000..f07e1e6
--- /dev/null
+++ b/pcilib/debug.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "error.h"
+
+void pcilib_debug_message(const char *function, const char *file, int line, const char *format, ...) {
+ va_list va;
+
+ if (!getenv(function)) return;
+
+ va_start(va, format);
+ pcilib_log_vmessage(file, line, PCILIB_LOG_DEBUG, format, va);
+ va_end(va);
+}
+