Last active
December 20, 2015 08:49
-
-
Save burczyk/6102939 to your computer and use it in GitHub Desktop.
iOS initialization for crash stack traces and Cocoa Lumberjack loggers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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