diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 99cbec5cbdb..29346d79990 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -845,6 +845,8 @@ D86B7B5C2B7A529C0017E8D9 /* SentryReplayEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = D86B7B5A2B7A529C0017E8D9 /* SentryReplayEvent.h */; }; D86B7B5D2B7A529C0017E8D9 /* SentryReplayEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = D86B7B5B2B7A529C0017E8D9 /* SentryReplayEvent.m */; }; D86F419827C8FEFA00490520 /* SentryCoreDataTrackerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86F419727C8FEFA00490520 /* SentryCoreDataTrackerExtension.swift */; }; + D8739CF32BECF70F007D2F66 /* SentryLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8739CF22BECF70F007D2F66 /* SentryLevel.swift */; }; + D8739CF92BECFFB5007D2F66 /* SentryTransactionNameSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8739CF82BECFFB5007D2F66 /* SentryTransactionNameSource.swift */; }; D8751FA5274743710032F4DE /* SentryNSURLSessionTaskSearchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8751FA4274743710032F4DE /* SentryNSURLSessionTaskSearchTests.swift */; }; D875ED0B276CC84700422FAC /* SentryNSDataTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D875ED0A276CC84700422FAC /* SentryNSDataTrackerTests.swift */; }; D87C89032BC43C9C0086C7DF /* SentryRedactOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87C89022BC43C9C0086C7DF /* SentryRedactOptions.swift */; }; @@ -1888,6 +1890,8 @@ D86B7B5A2B7A529C0017E8D9 /* SentryReplayEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryReplayEvent.h; path = include/SentryReplayEvent.h; sourceTree = ""; }; D86B7B5B2B7A529C0017E8D9 /* SentryReplayEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryReplayEvent.m; sourceTree = ""; }; D86F419727C8FEFA00490520 /* SentryCoreDataTrackerExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCoreDataTrackerExtension.swift; sourceTree = ""; }; + D8739CF22BECF70F007D2F66 /* SentryLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryLevel.swift; sourceTree = ""; }; + D8739CF82BECFFB5007D2F66 /* SentryTransactionNameSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTransactionNameSource.swift; sourceTree = ""; }; D8751FA4274743710032F4DE /* SentryNSURLSessionTaskSearchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSURLSessionTaskSearchTests.swift; sourceTree = ""; }; D8757D142A209F7300BFEFCC /* SentrySampleDecision+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySampleDecision+Private.h"; path = "include/SentrySampleDecision+Private.h"; sourceTree = ""; }; D875ED0A276CC84700422FAC /* SentryNSDataTrackerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryNSDataTrackerTests.swift; sourceTree = ""; }; @@ -2043,6 +2047,7 @@ 621D9F2D2B9B030E003D94DE /* Helper */ = { isa = PBXGroup; children = ( + D8739CF62BECFF86007D2F66 /* Log */, 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */, 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */, ); @@ -3680,6 +3685,22 @@ name = CoreData; sourceTree = ""; }; + D8739CF62BECFF86007D2F66 /* Log */ = { + isa = PBXGroup; + children = ( + D8739CF22BECF70F007D2F66 /* SentryLevel.swift */, + ); + path = Log; + sourceTree = ""; + }; + D8739CF72BECFF92007D2F66 /* Performance */ = { + isa = PBXGroup; + children = ( + D8739CF82BECFFB5007D2F66 /* SentryTransactionNameSource.swift */, + ); + path = Performance; + sourceTree = ""; + }; D875ED09276CC83200422FAC /* IO */ = { isa = PBXGroup; children = ( @@ -3801,6 +3822,7 @@ D8CAC02D2BA0663E00E38F34 /* Integrations */ = { isa = PBXGroup; children = ( + D8739CF72BECFF92007D2F66 /* Performance */, D8CAC02C2BA0663E00E38F34 /* SessionReplay */, ); path = Integrations; @@ -4488,6 +4510,7 @@ 7B30B67E26527894006B2752 /* SentryDisplayLinkWrapper.m in Sources */, 63FE711D20DA4C1000CDBAE8 /* SentryCrashCPU_arm64.c in Sources */, 844EDC77294144DB00C86F34 /* SentrySystemWrapper.mm in Sources */, + D8739CF92BECFFB5007D2F66 /* SentryTransactionNameSource.swift in Sources */, 630435FF1EBCA9D900C4D3FA /* SentryNSURLRequest.m in Sources */, 62C1AFAB2B7E10EA0038C5F7 /* SentrySpotlightTransport.m in Sources */, D87C892B2BC67BC20086C7DF /* SentryExperimentalOptions.swift in Sources */, @@ -4555,6 +4578,7 @@ 638DC9A11EBC6B6400A66E41 /* SentryRequestOperation.m in Sources */, 63AA767A1EB8D20500D153DE /* SentryLog.m in Sources */, 6344DDBA1EC3115C00D9160D /* SentryCrashReportConverter.m in Sources */, + D8739CF32BECF70F007D2F66 /* SentryLevel.swift in Sources */, 63FE70FD20DA4C1000CDBAE8 /* SentryCrashCachedData.c in Sources */, A8F17B2E2901765900990B25 /* SentryRequest.m in Sources */, 7BE1E33424F7E3CB009D3AD0 /* SentryMigrateSessionInit.m in Sources */, diff --git a/Sources/Sentry/Public/SentryDefines.h b/Sources/Sentry/Public/SentryDefines.h index 961660faf50..7520e37c40d 100644 --- a/Sources/Sentry/Public/SentryDefines.h +++ b/Sources/Sentry/Public/SentryDefines.h @@ -133,16 +133,8 @@ typedef NS_ENUM(NSInteger, SentryLogLevel) { /** * Sentry level. */ -typedef NS_ENUM(NSUInteger, SentryLevel) { - // Defaults to None which doesn't get serialized - kSentryLevelNone = 0, - // Goes from Debug to Fatal so possible to: (level > Info) { .. } - kSentryLevelDebug = 1, - kSentryLevelInfo = 2, - kSentryLevelWarning = 3, - kSentryLevelError = 4, - kSentryLevelFatal = 5 -}; +typedef NS_ENUM(NSUInteger, + SentryLevel); // This is a forward declaration, the actual enum is implemented in Swift. /** * Static internal helper to convert enum to string. @@ -166,11 +158,5 @@ static NSString *_Nonnull const kSentryFalseString = @"false"; /** * Transaction name source. */ -typedef NS_ENUM(NSInteger, SentryTransactionNameSource) { - kSentryTransactionNameSourceCustom = 0, - kSentryTransactionNameSourceUrl, - kSentryTransactionNameSourceRoute, - kSentryTransactionNameSourceView, - kSentryTransactionNameSourceComponent, - kSentryTransactionNameSourceTask -}; +typedef NS_ENUM(NSInteger, SentryTransactionNameSource); // This is a forward declaration, the + // actual enum is implemented in Swift. diff --git a/Sources/Sentry/SentryBreadcrumb.m b/Sources/Sentry/SentryBreadcrumb.m index 9c8b34b2708..238ab1f10af 100644 --- a/Sources/Sentry/SentryBreadcrumb.m +++ b/Sources/Sentry/SentryBreadcrumb.m @@ -2,6 +2,7 @@ #import "SentryDateUtils.h" #import "SentryLevelMapper.h" #import "SentryNSDictionarySanitize.h" +#import "SentrySwift.h" @interface SentryBreadcrumb () diff --git a/Sources/Sentry/SentryLevelMapper.m b/Sources/Sentry/SentryLevelMapper.m index 16f3a16dec4..ef2fbc72d09 100644 --- a/Sources/Sentry/SentryLevelMapper.m +++ b/Sources/Sentry/SentryLevelMapper.m @@ -1,5 +1,5 @@ #import "SentryLevelMapper.h" - +#import "SentrySwift.h" NS_ASSUME_NONNULL_BEGIN NSString *const kSentryLevelNameNone = @"none"; diff --git a/Sources/Sentry/SentryTransaction.m b/Sources/Sentry/SentryTransaction.m index bfafeb13083..ac682149bfe 100644 --- a/Sources/Sentry/SentryTransaction.m +++ b/Sources/Sentry/SentryTransaction.m @@ -2,6 +2,7 @@ #import "SentryEnvelopeItemType.h" #import "SentryMeasurementValue.h" #import "SentryNSDictionarySanitize.h" +#import "SentrySwift.h" #import "SentryTransactionContext.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Sources/Sentry/include/SentryLog.h b/Sources/Sentry/include/SentryLog.h index 2cb2619e7c6..80b0052b909 100644 --- a/Sources/Sentry/include/SentryLog.h +++ b/Sources/Sentry/include/SentryLog.h @@ -1,4 +1,5 @@ #import "SentryDefines.h" +#import "SentrySwift.h" @class SentryLogOutput; diff --git a/Sources/SentrySwiftUI/SentryInternal/SentryInternal.h b/Sources/SentrySwiftUI/SentryInternal/SentryInternal.h index ad13733819f..3cf25d689c8 100644 --- a/Sources/SentrySwiftUI/SentryInternal/SentryInternal.h +++ b/Sources/SentrySwiftUI/SentryInternal/SentryInternal.h @@ -9,14 +9,7 @@ NS_ASSUME_NONNULL_BEGIN -typedef NS_ENUM(NSInteger, SentryTransactionNameSource) { - kSentryTransactionNameSourceCustom = 0, - kSentryTransactionNameSourceUrl, - kSentryTransactionNameSourceRoute, - kSentryTransactionNameSourceView, - kSentryTransactionNameSourceComponent, - kSentryTransactionNameSourceTask -}; +typedef NS_ENUM(NSInteger, SentryTransactionNameSource); @class SentrySpanId; @protocol SentrySpan; diff --git a/Sources/Swift/Helper/Log/SentryLevel.swift b/Sources/Swift/Helper/Log/SentryLevel.swift new file mode 100644 index 00000000000..24bf025f73e --- /dev/null +++ b/Sources/Swift/Helper/Log/SentryLevel.swift @@ -0,0 +1,23 @@ +import Foundation + +@objc +public enum SentryLevel: UInt { + @objc(kSentryLevelNone) + case none = 0 + + // Goes from Debug to Fatal so possible to: (level > Info) { .. } + @objc(kSentryLevelDebug) + case debug = 1 + + @objc(kSentryLevelInfo) + case info = 2 + + @objc(kSentryLevelWarning) + case warning = 3 + + @objc(kSentryLevelError) + case error = 4 + + @objc(kSentryLevelFatal) + case fatal = 5 +} diff --git a/Sources/Swift/Integrations/Performance/SentryTransactionNameSource.swift b/Sources/Swift/Integrations/Performance/SentryTransactionNameSource.swift new file mode 100644 index 00000000000..337437a3299 --- /dev/null +++ b/Sources/Swift/Integrations/Performance/SentryTransactionNameSource.swift @@ -0,0 +1,22 @@ +import Foundation + +@objc +public enum SentryTransactionNameSource: Int { + @objc(kSentryTransactionNameSourceCustom) + case custom = 0 + + @objc(kSentryTransactionNameSourceUrl) + case url + + @objc(kSentryTransactionNameSourceRoute) + case route + + @objc(kSentryTransactionNameSourceView) + case view + + @objc(kSentryTransactionNameSourceComponent) + case component + + @objc(kSentryTransactionNameSourceTask) + case sourceTask +} diff --git a/Tests/SentryTests/SentryKSCrashReportConverterTests.m b/Tests/SentryTests/SentryKSCrashReportConverterTests.m index 5a88d8e9399..b8d7dcb253a 100644 --- a/Tests/SentryTests/SentryKSCrashReportConverterTests.m +++ b/Tests/SentryTests/SentryKSCrashReportConverterTests.m @@ -12,6 +12,7 @@ #import "SentryThread.h" #import "SentryUser.h" #import +@import Sentry; @interface SentryCrashReportConverterTests : XCTestCase diff --git a/Tests/SentryTests/SentryScopeTests.m b/Tests/SentryTests/SentryScopeTests.m index 5da23c3721e..7a7de3e9186 100644 --- a/Tests/SentryTests/SentryScopeTests.m +++ b/Tests/SentryTests/SentryScopeTests.m @@ -4,6 +4,7 @@ #import "SentryScope.h" #import "SentryUser.h" #import +@import Sentry; @interface SentryScopeTests : XCTestCase diff --git a/Tests/SentryTests/SentryTests.m b/Tests/SentryTests/SentryTests.m index 9791885e1f8..2417ed83bf3 100644 --- a/Tests/SentryTests/SentryTests.m +++ b/Tests/SentryTests/SentryTests.m @@ -11,6 +11,7 @@ #import "SentryOptions+HybridSDKs.h" #import "SentrySDK+Private.h" #import +@import Sentry; @interface SentryBreadcrumbTracker ()