Skip to content

Instantly share code, notes, and snippets.

@burczyk
Last active December 20, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burczyk/6102939 to your computer and use it in GitHub Desktop.
Save burczyk/6102939 to your computer and use it in GitHub Desktop.
iOS initialization for crash stack traces and Cocoa Lumberjack loggers
#import "DDASLLogger.h"
#import "DDTTYLogger.h"
int ddLogLevel = LOG_LEVEL_VERBOSE;
#pragma mark Initialization
- (void) initializeLoggers {
[DDLog addLogger:[DDASLLogger sharedInstance]];
[DDLog addLogger:[DDTTYLogger sharedInstance]];
[[DDTTYLogger sharedInstance] setColorsEnabled:YES];
[[DDTTYLogger sharedInstance] setForegroundColor:[UIColor blueColor] backgroundColor:nil forFlag:LOG_FLAG_VERBOSE];
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
}
#pragma mark crash reporting
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// [[[GAI sharedInstance] defaultTracker] trackException:YES withNSException:exception];
// [Flurry logError:@"Uncaught" message:@"Crash!" exception:exception];
// [[RavenClient sharedClient] captureException:exception sendNow:NO];
}
//In Xcode bring up the Scheme Editor (Product -> Edit Scheme...)
//Select "Run" (on the left), and then the "Arguments" tab
//Add a new Environment Variable named "XcodeColors", with a value of "YES"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment