-#ifndef VG_LOG_C
#include <stdarg.h>
#include <string.h>
#include <malloc.h>
-#include "vg_stdint.h"
#include "vg_platform.h"
#include "vg_log.h"
+#include "vg_string.h"
#ifndef _WIN32
#include <execinfo.h>
#endif
-static void _vg_log_append_line( const char *str ){
+struct vg_log vg_log;
+
+static void _vg_log_append_line( const char *str )
+{
if( vg_log.log_line_count < vg_list_size( vg_log.log ) )
vg_log.log_line_count ++;
vg_log.log_line_current = 0;
}
-static void _vg_logx_va( FILE *file,
+void _vg_logx_va( FILE *file,
const char *location, const char *prefix,
const char *colour,
const char *fmt, va_list args )
* | dwajdkiawjdiw
*/
-#ifdef VG_GAME
- SDL_AtomicLock( &log_print_sl );
+#ifdef VG_ENGINE
+ SDL_AtomicLock( &vg_log.print_sl );
#endif
char buffer[4096];
_vg_log_append_line( logline );
if( location ){
-#ifdef VG_GAME
+#ifdef VG_ENGINE
const char *thread_colours[] = {
KGRN, KMAG, KCYN, KYEL, KBLU
};
}
}
-#ifdef VG_GAME
- SDL_AtomicUnlock( &log_print_sl );
+#ifdef VG_ENGINE
+ SDL_AtomicUnlock( &vg_log.print_sl );
#endif
}
-static void vg_logx( FILE *file,
- const char *location, const char *prefix,
- const char *colour,
- const char *fmt, ... ){
+void vg_logx( FILE *file,
+ const char *location, const char *prefix,
+ const char *colour,
+ const char *fmt, ... )
+{
va_list args;
va_start( args, fmt );
va_end( args );
}
-static void vg_print_backtrace(void){
+void vg_print_backtrace(void)
+{
#ifndef _WIN32
-
void *array[20];
char **strings;
int size, i;
size = backtrace( array, 20 );
strings = backtrace_symbols( array, size );
- if( strings != NULL ){
+ if( strings != NULL )
+ {
vg_error( "---------------- gnu backtrace -------------\n" );
for( int i=0; i<size; i++ )
#endif
}
-
-#endif /* VG_LOG_C */