X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=blobdiff_plain;f=vg_log.h;h=d30e7ba330bb827d9884a63c1acf05a53bebf477;hp=8d2420a5fa7125d38ef05343d7422ea7f024c2e0;hb=HEAD;hpb=dd402a7717847a2d74c3b98e3f3970cde4874a73 diff --git a/vg_log.h b/vg_log.h index 8d2420a..cf2b737 100644 --- a/vg_log.h +++ b/vg_log.h @@ -1,15 +1,17 @@ -#ifndef VG_LOG_H -#define VG_LOG_H +#pragma once + +#include "vg_platform.h" +#include #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( ... ) \ @@ -37,28 +39,30 @@ #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