summaryrefslogtreecommitdiff
path: root/common/log.c
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-04-06 17:04:05 -0400
committeriamcheeseman <[email protected]>2026-04-06 17:06:53 -0400
commit957c64c7b8b5e98d8a03dd84c7e27e7991fb9dbc (patch)
treef5fc230703791cee8d8e7851fb87eaef07ae63a2 /common/log.c
Initial commit
Diffstat (limited to 'common/log.c')
-rw-r--r--common/log.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/common/log.c b/common/log.c
new file mode 100644
index 0000000..fb82de1
--- /dev/null
+++ b/common/log.c
@@ -0,0 +1,34 @@
+#include "log.h"
+
+#include <stdarg.h>
+
+#include "common.h"
+
+void 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 _log_plain(FILE *file, const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(file, fmt, args);
+ va_end(args);
+
+ putc('\n', file);
+}