Skip to content

Commit 7c67a2d

Browse files
authored
Merge pull request #92 from smartmobilefactory/feature/SentrySDK
added support for debug mode
2 parents 15e72ff + cb9b5c6 commit 7c67a2d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

Sentry/SentrySDK+SMFLogger.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ class SentrySDK: NSObject {
5252
/// This will setup the SentrySDK with the common base configuration. Crashes will be detected if the app is build with the release build type and the sentry dsn taken from the info plists.
5353
///
5454
/// - Parameters:
55-
/// - configuration: sentry dsn string
55+
/// - configuration: Configuration object
5656
static func setup(configuration: SentrySDK.Configuration) {
57-
58-
// Make sure SentrySDK is not setup in a debug build
59-
guard (self.isDebugBuild == false) else {
60-
// Configure SentrySDK only for non debug builds or if the exception flag is set to true
57+
guard (self.isDebugBuild == false || configuration.enableDebug == true) else {
6158
return
6259
}
6360

@@ -150,6 +147,7 @@ extension SentrySDK {
150147
#endif
151148
}()
152149

150+
fileprivate var enableDebug : Bool = false
153151
fileprivate var sentryDSN : String = ""
154152
fileprivate var enableSMFLogUpload : Bool = true
155153
fileprivate var enableBreadcrumbs : Bool = true
@@ -162,7 +160,7 @@ extension SentrySDK {
162160
/// - enableSMFLogUpload: true if you want the SMFLogger logs to be submitted with a crash
163161
/// - enableBreadcrumbs: true if you want Sentry to attach the last user interaction before a crash
164162
/// - smfLogUploadMaxSize: The max count of characters which should be uploaded
165-
init(sentryDSN: String? = nil, enableSMFLogUpload: Bool = true, smfLogUploadMaxSize: Int = SentryConstants.smfLogUploadMaxSizeDefault, smfEnableBreadcrumbs: Bool = true) {
163+
init(sentryDSN: String? = nil, enableSMFLogUpload: Bool = true, smfLogUploadMaxSize: Int = SentryConstants.smfLogUploadMaxSizeDefault, smfEnableBreadcrumbs: Bool = true, enableDebug: Bool = false) {
166164

167165
// Get the Sentry DSN
168166
let dsnFromPlist = Bundle.main.object(forInfoDictionaryKey: SentryConstants.plistSentryDsn) as? String
@@ -172,6 +170,7 @@ extension SentrySDK {
172170
return
173171
}
174172

173+
self.enableDebug = enableDebug
175174
self.sentryDSN = _sentryDsn
176175
self.enableBreadcrumbs = smfEnableBreadcrumbs
177176
self.enableSMFLogUpload = enableSMFLogUpload

0 commit comments

Comments
 (0)