mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
(iOS) Kill DIAGLOG; will be better to make file logging optional and make the log view able to display to log file. (Allowing the log to persist across crashes and aborts)
This commit is contained in:
parent
20cb48818c
commit
b649099467
@ -22,7 +22,6 @@
|
||||
static NSMutableArray* g_messages;
|
||||
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#ifndef HAVE_DEBUG_DIAGLOG
|
||||
void ios_add_log_message(const char* format, ...)
|
||||
{
|
||||
pthread_mutex_lock(&g_lock);
|
||||
@ -39,54 +38,6 @@ void ios_add_log_message(const char* format, ...)
|
||||
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
}
|
||||
#else
|
||||
static FILE* old_stdout;
|
||||
static FILE* old_stderr;
|
||||
static FILE* log_stream;
|
||||
|
||||
static int stdout_write(void* mem_buffer, const char* data, int len)
|
||||
{
|
||||
pthread_mutex_lock(&g_lock);
|
||||
|
||||
g_messages = g_messages ? g_messages : [NSMutableArray array];
|
||||
|
||||
char buffer[len + 10];
|
||||
strncpy(buffer, data, len);
|
||||
buffer[len] = 0;
|
||||
|
||||
[g_messages addObject:[NSString stringWithFormat:@"%s", buffer]];
|
||||
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void ios_log_init()
|
||||
{
|
||||
if (!log_stream)
|
||||
{
|
||||
old_stdout = stdout;
|
||||
old_stderr = stderr;
|
||||
|
||||
log_stream = fwopen(0, stdout_write);
|
||||
setvbuf(log_stream, 0, _IOLBF, 0);
|
||||
|
||||
stdout = log_stream;
|
||||
stderr = log_stream;
|
||||
}
|
||||
}
|
||||
|
||||
void ios_log_quit()
|
||||
{
|
||||
if (log_stream)
|
||||
{
|
||||
stdout = old_stdout;
|
||||
stderr = old_stderr;
|
||||
fclose(log_stream);
|
||||
log_stream = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@implementation RALogView
|
||||
|
||||
|
@ -227,10 +227,6 @@ static void event_reload_config(void* userdata)
|
||||
// UIApplicationDelegate
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
#ifdef HAVE_DEBUG_DIAGLOG
|
||||
ios_log_init();
|
||||
#endif
|
||||
|
||||
self.delegate = self;
|
||||
|
||||
// Setup window
|
||||
|
@ -30,13 +30,6 @@ void ios_set_game_view_sync(unsigned interval);
|
||||
void ios_get_game_view_size(unsigned *width, unsigned *height);
|
||||
void ios_bind_game_view_fbo();
|
||||
|
||||
#ifndef HAVE_DEBUG_DIAGLOG
|
||||
void ios_add_log_message(const char* format, ...);
|
||||
#else
|
||||
void ios_log_init();
|
||||
void ios_log_quit();
|
||||
// Thread safe
|
||||
#define ios_add_log_message(...) do { printf(__VA_ARGS__); printf("\n"); } while(0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user