projects
/
vg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build system revision
[vg.git]
/
vg_log.c
diff --git
a/vg_log.c
b/vg_log.c
index 638d63feaa13172d3df2e7cde302c38f34a77d2d..84807daeaca72e1ee0f96b7d7ae3361ad86173e9 100644
(file)
--- a/
vg_log.c
+++ b/
vg_log.c
@@
-1,16
+1,18
@@
-#ifndef VG_LOG_C
#include <stdarg.h>
#include <string.h>
#include <malloc.h>
#include <stdarg.h>
#include <string.h>
#include <malloc.h>
-#include "vg_stdint.h"
#include "vg_platform.h"
#include "vg_log.h"
#include "vg_platform.h"
#include "vg_log.h"
+#include "vg_string.h"
#ifndef _WIN32
#include <execinfo.h>
#endif
#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 ++;
if( vg_log.log_line_count < vg_list_size( vg_log.log ) )
vg_log.log_line_count ++;
@@
-21,7
+23,7
@@
static void _vg_log_append_line( const char *str ){
vg_log.log_line_current = 0;
}
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 )
const char *location, const char *prefix,
const char *colour,
const char *fmt, va_list args )
@@
-32,8
+34,8
@@
static void _vg_logx_va( FILE *file,
* | dwajdkiawjdiw
*/
* | dwajdkiawjdiw
*/
-#ifdef VG_
GAM
E
- SDL_AtomicLock( &
log_
print_sl );
+#ifdef VG_
ENGIN
E
+ SDL_AtomicLock( &
vg_log.
print_sl );
#endif
char buffer[4096];
#endif
char buffer[4096];
@@
-62,7
+64,7
@@
static void _vg_logx_va( FILE *file,
_vg_log_append_line( logline );
if( location ){
_vg_log_append_line( logline );
if( location ){
-#ifdef VG_
GAM
E
+#ifdef VG_
ENGIN
E
const char *thread_colours[] = {
KGRN, KMAG, KCYN, KYEL, KBLU
};
const char *thread_colours[] = {
KGRN, KMAG, KCYN, KYEL, KBLU
};
@@
-87,15
+89,16
@@
static void _vg_logx_va( FILE *file,
}
}
}
}
-#ifdef VG_
GAM
E
- SDL_AtomicUnlock( &
log_
print_sl );
+#ifdef VG_
ENGIN
E
+ SDL_AtomicUnlock( &
vg_log.
print_sl );
#endif
}
#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_list args;
va_start( args, fmt );
@@
-109,9
+112,9
@@
static void vg_logx( FILE *file,
va_end( args );
}
va_end( args );
}
-static void vg_print_backtrace(void){
+void vg_print_backtrace(void)
+{
#ifndef _WIN32
#ifndef _WIN32
-
void *array[20];
char **strings;
int size, i;
void *array[20];
char **strings;
int size, i;
@@
-119,7
+122,8
@@
static void vg_print_backtrace(void){
size = backtrace( array, 20 );
strings = backtrace_symbols( array, size );
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++ )
vg_error( "---------------- gnu backtrace -------------\n" );
for( int i=0; i<size; i++ )
@@
-132,5
+136,3
@@
static void vg_print_backtrace(void){
#endif
}
#endif
}
-
-#endif /* VG_LOG_C */