-#ifndef VG_LOG_H
-#define VG_LOG_H
+#pragma once
+
+#include "vg_platform.h"
+#include <stdio.h>
#define VG_LOG_MCSTR(S) VG_LOG_MCSTR2(S)
#define VG_LOG_MCSTR2(S) #S
-#define VG_LOG_WHERE "@"__FILE__":"VG_LOG_MCSTR(__LINE__)\
+#define VG_LOG_WHERE "@" __FILE__ ":" VG_LOG_MCSTR(__LINE__)\
" "
#define vg_success( ... ) \
vg_logx(stdout,VG_LOG_WHERE,"success",KGRN,__VA_ARGS__)
#define vg_info( ... ) \
- vg_logx(stdout,VG_LOG_WHERE,"info",KWHT,__VA_ARGS__)
+ vg_logx(stdout,VG_LOG_WHERE,"info",KNRM,__VA_ARGS__)
#define vg_warn( ... ) \
vg_logx(stdout,VG_LOG_WHERE,"warn",KYEL,__VA_ARGS__ )
#define vg_error( ... ) \
#define PRINTF_U64 "%lu"
#endif
-#ifdef VG_GAME
+#ifdef VG_ENGINE
#include "dep/sdl/include/SDL.h"
- static SDL_SpinLock log_print_sl;
#endif
-struct vg_log{
+struct vg_log
+{
char log[64][96];
u32 log_line_count, log_line_current;
-}
-static vg_log;
-static void vg_logx( FILE *file,
- const char *location, const char *prefix,
- const char *colour,
- const char *fmt, ... );
+#ifdef VG_ENGINE
+ SDL_SpinLock print_sl;
+#endif
+}
+extern vg_log;
-static void _vg_logx_va( FILE *file,
- const char *location, const char *prefix,
- const char *colour,
- const char *fmt, va_list args );
+void vg_logx( FILE *file,
+ const char *location, const char *prefix,
+ const char *colour,
+ const char *fmt, ... );
-static void vg_print_backtrace(void);
+void _vg_logx_va( FILE *file,
+ const char *location, const char *prefix,
+ const char *colour,
+ const char *fmt, va_list args );
+void vg_print_backtrace(void);
-#endif