-
-
Notifications
You must be signed in to change notification settings - Fork 371
Flush Logs on WillTerminate or WillResignActive Notifications
#6909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
denrase
wants to merge
29
commits into
main
Choose a base branch
from
feat/flush-logs-on-app-state-change
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+287
−20
Open
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
be66378
Flush logs when app terminates or resigns active
denrase fd55fdf
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase 115a625
fix deadlock issue
denrase 71f478e
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase 162273e
rename group name
denrase 3f4813d
move into existing confitional block
denrase aa1fbc9
Use dispatch_queue_set_specific/dispatch_get_specific to get corrrect…
denrase 6cdd1b0
cleanup queu specific key
denrase 8e36044
check client for nil
denrase d502009
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase d22d16e
Listen to notifications directly in integration
denrase 539d652
move integration to swift class
denrase e214d5e
use dedicated queue for log batcher
denrase b493f18
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase 13de622
update
denrase e270fa1
cleanup
denrase 19df878
cleanup
denrase 0f74c74
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase 6daca9e
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase e3f2df8
update cl
denrase dd00065
fix build issue :facepalm
denrase f2e5b8b
update changelog
denrase f9a7ed8
Merge branch 'main' into feat/flush-logs-on-app-state-change
philprime d828f69
remove kIntegrationOptionEnableLogs
denrase 3b22387
use dsnForTestCase
denrase 0682b5b
update test setup
denrase fda13c2
Call with QOS_CLASS_DEFAULT instead of DISPATCH_QUEUE_PRIORITY_DEFAULT
denrase 2edc82f
Merge branch 'main' into feat/flush-logs-on-app-state-change
denrase 7a57e7a
fix incorrect import of NSApplication in macCatalyst environments
denrase File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,61 @@ | ||
| #import "SentryLogFlushIntegration.h" | ||
| #import "SentryClient+Private.h" | ||
| #import "SentryHub.h" | ||
| #import "SentryLogC.h" | ||
| #import "SentrySDK+Private.h" | ||
| #import "SentrySwift.h" | ||
|
|
||
| #if SENTRY_HAS_UIKIT | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface SentryLogFlushIntegration () <SentryAppStateListener> | ||
denrase marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @end | ||
|
|
||
| @implementation SentryLogFlushIntegration | ||
|
|
||
| - (BOOL)installWithOptions:(SentryOptions *)options | ||
| { | ||
| if (![super installWithOptions:options]) { | ||
| return NO; | ||
| } | ||
|
|
||
| [[[SentryDependencyContainer sharedInstance] appStateManager] addListener:self]; | ||
denrase marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return YES; | ||
| } | ||
|
|
||
| - (SentryIntegrationOption)integrationOptions | ||
| { | ||
| return kIntegrationOptionEnableLogs; | ||
| } | ||
|
|
||
| - (void)uninstall | ||
| { | ||
| [[[SentryDependencyContainer sharedInstance] appStateManager] removeListener:self]; | ||
| } | ||
|
|
||
| # pragma mark - SentryAppStateListener | ||
|
|
||
| - (void)appStateManagerWillResignActive | ||
| { | ||
| SentryClientInternal *client = [SentrySDKInternal.currentHub getClient]; | ||
| if (client != nil) { | ||
| [client flushLogs]; | ||
| } | ||
| } | ||
|
|
||
| - (void)appStateManagerWillTerminate | ||
| { | ||
| SentryClientInternal *client = [SentrySDKInternal.currentHub getClient]; | ||
| if (client != nil) { | ||
| [client flushLogs]; | ||
| } | ||
| } | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
|
|
||
| #endif // SENTRY_HAS_UIKIT | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| #import "SentryBaseIntegration.h" | ||
| #import "SentryDefines.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface SentryLogFlushIntegration : SentryBaseIntegration | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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,7 @@ | ||
| @_implementationOnly import _SentryPrivate | ||
| import Foundation | ||
|
|
||
| @_spi(Private) @objc public protocol SentryAppStateListener: NSObjectProtocol { | ||
| @objc optional func appStateManagerWillResignActive() | ||
| @objc optional func appStateManagerWillTerminate() | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.