]> git.itanic.dy.fi Git - log-plotter/blobdiff - trace.c
Rename debug.[ch] to trace.[ch]
[log-plotter] / trace.c
diff --git a/trace.c b/trace.c
new file mode 100644 (file)
index 0000000..2ef8d8f
--- /dev/null
+++ b/trace.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "trace.h"
+
+int trace_level = TRACE_INFO;
+
+void print_trace(const char *file, int line, int l,
+               const char *fmt, ...)
+{
+       FILE *out_file;
+        va_list args;
+
+       if (l > trace_level)
+               return;
+
+       if (l == TRACE_ERR)
+               out_file = stderr;
+       else
+               out_file = stdout;
+
+        va_start(args, fmt);
+       vfprintf(out_file, fmt, args);
+        va_end(args);
+}