2
0

Update Sentry SDK.

This commit is contained in:
Maarten Billemont 2021-10-31 14:32:31 -04:00
parent eda9749cf2
commit 94a6c925bc
2 changed files with 19 additions and 19 deletions

View File

@ -43,7 +43,7 @@ __END_DECLS
\ \
if (__error && [[MPConfig get].sendInfo boolValue]) { \ if (__error && [[MPConfig get].sendInfo boolValue]) { \
SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError]; \ SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError]; \
event.message = strf( message_ @": %@", ##__VA_ARGS__, [__error localizedDescription]); \ event.message = [[SentryMessage alloc] initWithFormatted:strf( message_ @": %@", ##__VA_ARGS__, [__error localizedDescription])]; \
event.logger = @"MPError"; \ event.logger = @"MPError"; \
event.fingerprint = @[ message_, __error.domain, @(__error.code) ]; \ event.fingerprint = @[ message_, __error.domain, @(__error.code) ]; \
[SentrySDK captureEvent:event]; \ [SentrySDK captureEvent:event]; \

View File

@ -60,22 +60,6 @@ MP_LIBS_END
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@try { @try {
// Sentry
[SentrySDK startWithOptions:@{
@"dsn" : NilToNSNull( decrypt( sentryDSN ) ),
#ifdef DEBUG
@"debug" : @(NO), //@(YES),
@"environment" : @"Development",
#elif PUBLIC
@"debug" : @(NO),
@"environment" : @"Public",
#else
@"debug" : @(NO),
@"environment" : @"Private",
#endif
@"enabled" : @([[MPiOSConfig get].sendInfo boolValue] || ![[MPiOSConfig get].sendInfoDecided boolValue]),
@"enableAutoSessionTracking": @(YES),
}];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
PearlLogLevel level = PearlLogLevelWarn; PearlLogLevel level = PearlLogLevelWarn;
if ([[MPConfig get].sendInfo boolValue]) if ([[MPConfig get].sendInfo boolValue])
@ -834,7 +818,23 @@ MP_LIBS_END
if ([PearlLogger get].printLevel > PearlLogLevelInfo) if ([PearlLogger get].printLevel > PearlLogLevelInfo)
[PearlLogger get].printLevel = PearlLogLevelInfo; [PearlLogger get].printLevel = PearlLogLevelInfo;
[SentrySDK.currentHub getClient].options.enabled = @YES; // Sentry
if (!SentrySDK.isEnabled)
[SentrySDK startWithOptions:@{
@"dsn" : NilToNSNull( decrypt( sentryDSN ) ),
#ifdef DEBUG
@"debug" : @(NO), //@(YES),
@"environment" : @"Development",
#elif PUBLIC
@"debug" : @(NO),
@"environment" : @"Public",
#else
@"debug" : @(NO),
@"environment" : @"Private",
#endif
@"enableAutoSessionTracking": @(YES),
}];
[SentrySDK configureScope:^(SentryScope *scope) { [SentrySDK configureScope:^(SentryScope *scope) {
[scope setExtraValue:[MPiOSConfig get].rememberLogin forKey:@"rememberLogin"]; [scope setExtraValue:[MPiOSConfig get].rememberLogin forKey:@"rememberLogin"];
[scope setExtraValue:[MPiOSConfig get].sendInfo forKey:@"sendInfo"]; [scope setExtraValue:[MPiOSConfig get].sendInfo forKey:@"sendInfo"];
@ -859,7 +859,7 @@ MP_LIBS_END
} }
else { else {
[Countly.sharedInstance cancelConsentForFeatures:countlyFeatures]; [Countly.sharedInstance cancelConsentForFeatures:countlyFeatures];
[SentrySDK.currentHub getClient].options.enabled = @NO; [SentrySDK close];
} }
} }