aboutsummaryrefslogtreecommitdiff
path: root/teensy/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'teensy/log.c')
-rw-r--r--teensy/log.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/teensy/log.c b/teensy/log.c
new file mode 100644
index 0000000..fbd96a2
--- /dev/null
+++ b/teensy/log.c
@@ -0,0 +1,33 @@
+#include "log.h"
+
+#include <stdarg.h>
+
+#include "common.h"
+
+void ty_log_msg(
+ FILE *file,
+ const char *src_name,
+ int src_line,
+ const char *type,
+ const char *fmt,
+ ...
+)
+{
+ fprintf(file, "[%s] (%s:%d) ", type, src_name, src_line);
+
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(file, fmt, args);
+ va_end(args);
+
+ putc('\n', file);
+}
+
+void _ty_log_plain(FILE *file, const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(file, fmt, args);
+ va_end(args);
+ putc('\n', file);
+}