-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add default attributes for network and Bluetooth status * Add attachment paths * Expose attachment path in public API * Send attachments using multipart * Store attachment paths in CoreData * Add file reading option .mappedIfSafe * Handle crashes on macOS by BacktraceCrashExceptionApplication * Update documentation * Add mocks for URLSession * Add mocks for HTTP responses * Improve code coverage * Run CrashReporter only when the debugger is detached * Add reporting policy * Check if the debugger is attached * Update BacktraceClientConfiguration * Add additional attributes for NFC and location * Update README.md * Add default attributes for: - `guid` - unique user identifier - `error.message` - `hostaname` - `lang.name` - `lang.version` - NFC - location
- Loading branch information
Showing
62 changed files
with
1,988 additions
and
486 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Cocoa | ||
|
||
/// `NSApplication` subclass to catch additional exceptions on macOS | ||
@objc public class BacktraceCrashExceptionApplication: NSApplication { | ||
|
||
/// Catch all exceptions and send them to `Backtrace` | ||
public override func reportException(_ exception: NSException) { | ||
super.reportException(exception) | ||
BacktraceClient.shared?.send(exception: exception, attachmentPaths: [], completion: {_ in }) | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test from iOS simulator | ||
test Example-iOS-ObjC | ||
backtrace sample text file |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test from iOS simulator | ||
test Example-iOS | ||
backtrace sample text file |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,74 @@ | ||
#import "AppDelegate.h" | ||
@import Backtrace; | ||
|
||
@interface AppDelegate () | ||
@interface AppDelegate () <BacktraceClientDelegate> | ||
|
||
@end | ||
|
||
@implementation AppDelegate | ||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { | ||
|
||
BacktraceCredentials *credentials = [[BacktraceCredentials alloc] | ||
initWithEndpoint: [NSURL URLWithString: @"https://backtrace.io"] | ||
token: @"token"]; | ||
BacktraceClientConfiguration *configuration = [[BacktraceClientConfiguration alloc] initWithCredentials: credentials | ||
dbSettings: [BacktraceDatabaseSettings new] | ||
reportsPerMin: 3]; | ||
BacktraceDatabaseSettings *backtraceDatabaseSettings = [[BacktraceDatabaseSettings alloc] init]; | ||
backtraceDatabaseSettings.maxRecordCount = 1000; | ||
backtraceDatabaseSettings.maxDatabaseSize = 10; | ||
backtraceDatabaseSettings.retryInterval = 5; | ||
backtraceDatabaseSettings.retryLimit = 3; | ||
backtraceDatabaseSettings.retryBehaviour = RetryBehaviourInterval; | ||
backtraceDatabaseSettings.retryOrder = RetryOderStack; | ||
|
||
BacktraceClientConfiguration *configuration = [[BacktraceClientConfiguration alloc] | ||
initWithCredentials: credentials | ||
dbSettings: backtraceDatabaseSettings | ||
reportsPerMin: 3 | ||
allowsAttachingDebugger: TRUE]; | ||
BacktraceClient.shared = [[BacktraceClient alloc] initWithConfiguration: configuration error: nil]; | ||
[BacktraceClient.shared setUserAttributes: @{@"foo": @"bar"}]; | ||
BacktraceClient.shared.delegate = self; | ||
|
||
@try { | ||
NSArray *array = @[]; | ||
NSObject *object = array[1]; //will throw exception | ||
} @catch (NSException *exception) { | ||
[[BacktraceClient shared] sendWithCompletion:^(BacktraceResult * _Nonnull result) { | ||
NSArray *paths = @[[[NSBundle mainBundle] pathForResource: @"test" ofType: @"txt"]]; | ||
[[BacktraceClient shared] sendWithAttachmentPaths: paths completion: ^(BacktraceResult * _Nonnull result) { | ||
NSLog(@"%@", result); | ||
}]; | ||
} @finally { | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
- (void)applicationWillTerminate:(NSNotification *)aNotification { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
#pragma mark - BacktraceClientDelegate | ||
- (BacktraceReport *)willSend:(BacktraceReport *)report { | ||
NSMutableDictionary *dict = [report.attributes mutableCopy]; | ||
[dict setObject: @"just before send" forKey: @"added"]; | ||
report.attributes = dict; | ||
return report; | ||
} | ||
|
||
- (void)serverDidFail:(NSError *)error { | ||
|
||
} | ||
|
||
- (void)serverDidResponse:(BacktraceResult *)result { | ||
|
||
} | ||
|
||
- (NSURLRequest *)willSendRequest:(NSURLRequest *)request { | ||
return request; | ||
} | ||
|
||
- (void)didReachLimit:(BacktraceResult *)result { | ||
|
||
} | ||
|
||
@end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test from macOS | ||
test Example-macOS-ObjC | ||
backtrace sample text file |
Oops, something went wrong.