Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -35,10 +35,11 @@ #import "OFNotificationCenter.h" #import "OFPair.h" #import "OFRunLoop+Private.h" #import "OFRunLoop.h" #import "OFSandbox.h" +#import "OFStdIOStream.h" #import "OFString.h" #import "OFSystemInfo.h" #import "OFThread+Private.h" #import "OFThread.h" @@ -258,13 +259,12 @@ continue; } pos = [tmp rangeOfString: @"="].location; if (pos == OFNotFound) { - fprintf(stderr, - "Warning: Invalid environment " - "variable: %s\n", tmp.UTF8String); + OFLog(@"Warning: Invalid environment " + "variable: %@", tmp); continue; } key = [tmp substringToIndex: pos]; value = [tmp substringFromIndex: pos + 1]; @@ -300,13 +300,12 @@ continue; } pos = [tmp rangeOfString: @"="].location; if (pos == OFNotFound) { - fprintf(stderr, - "Warning: Invalid environment " - "variable: %s\n", tmp.UTF8String); + OFLog(@"Warning: Invalid environment " + "variable: %@", tmp); continue; } key = [tmp substringToIndex: pos]; value = [tmp substringFromIndex: pos + 1]; @@ -394,12 +393,12 @@ void *pool = objc_autoreleasePoolPush(); OFString *key, *value; char *sep; if ((sep = strchr(*env, '=')) == NULL) { - fprintf(stderr, "Warning: Invalid " - "environment variable: %s\n", *env); + OFLog(@"Warning: Invalid environment " + "variable: %s", *env); continue; } key = [OFString stringWithCString: *env Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -39,10 +39,11 @@ #import "OFMethodSignature.h" #import "OFRunLoop.h" #if !defined(OF_HAVE_ATOMIC_OPS) && defined(OF_HAVE_THREADS) # import "OFPlainMutex.h" /* For OFSpinlock */ #endif +#import "OFStdIOStream.h" #import "OFString.h" #import "OFThread.h" #import "OFTimer.h" #import "OFValue.h" @@ -250,17 +251,16 @@ #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaughtExceptionHandler(id exception) { - OFString *description = [exception description]; OFArray OF_GENERIC(OFValue *) *stackTraceAddresses = nil; OFArray OF_GENERIC(OFString *) *stackTraceSymbols = nil; OFStringEncoding encoding = [OFLocale encoding]; - fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", - [description cStringWithEncoding: encoding]); + OFLog(@"Runtime error: Unhandled exception:"); + OFLog(@"%@", exception); if ([exception respondsToSelector: @selector(stackTraceAddresses)]) stackTraceAddresses = [exception stackTraceAddresses]; if (stackTraceAddresses != nil) { @@ -271,32 +271,31 @@ stackTraceSymbols = [exception stackTraceSymbols]; if (stackTraceSymbols.count != count) stackTraceSymbols = nil; - fputs("\nStack trace:\n", stderr); + OFLog(@""); + OFLog(@"Stack trace:"); if (stackTraceSymbols != nil) { for (size_t i = 0; i < count; i++) { void *address = [[stackTraceAddresses objectAtIndex: i] pointerValue]; const char *symbol = [[stackTraceSymbols objectAtIndex: i] cStringWithEncoding: encoding]; - fprintf(stderr, " %p %s\n", address, symbol); + OFLog(@" %p %s", address, symbol); } } else { for (size_t i = 0; i < count; i++) { void *address = [[stackTraceAddresses objectAtIndex: i] pointerValue]; - fprintf(stderr, " %p\n", address); + OFLog(@" %p", address); } } - - fputs("\n", stderr); } abort(); } #endif