From ae01cc3534ca023012e91c7cb418d3a26e17021d Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 21:03:02 -0300 Subject: [PATCH 01/18] Logging module --- Package.swift | 16 +- Sources/Logging/Logging.swift | 8 + Sources/Logging/README.md | 1 + Sources/Logging/Tests/LoggingTests.swift | 9 + Split.podspec | 5 + Split.xcodeproj/project.pbxproj | 383 ++++++++++++++++++++++- Split/_KwiftDependencies.swift | 6 + 7 files changed, 418 insertions(+), 10 deletions(-) create mode 100644 Sources/Logging/Logging.swift create mode 100644 Sources/Logging/README.md create mode 100644 Sources/Logging/Tests/LoggingTests.swift create mode 100644 Split/_KwiftDependencies.swift diff --git a/Package.swift b/Package.swift index f175b80ea..ac690b459 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,19 @@ let package = Package( "Common/Yaml/LICENSE", "Info.plist", "Split.h" - ] - ) + ], + dependencies: ["Logging"] + ), + + .target( + name: "Logging", + dependencies: [] + ), + .testTarget( + name: "LoggingTests", + dependencies: ["Logging"], + path: "Sources/Logging/Tests" + ), + // #INJECT_TARGET ] ) diff --git a/Sources/Logging/Logging.swift b/Sources/Logging/Logging.swift new file mode 100644 index 000000000..d25f965e4 --- /dev/null +++ b/Sources/Logging/Logging.swift @@ -0,0 +1,8 @@ +import Foundation + +public struct LoggingInternal { + public init() {} + public func action() { + print("Logging ready.") + } +} \ No newline at end of file diff --git a/Sources/Logging/README.md b/Sources/Logging/README.md new file mode 100644 index 000000000..b921bbe50 --- /dev/null +++ b/Sources/Logging/README.md @@ -0,0 +1 @@ +# Logging diff --git a/Sources/Logging/Tests/LoggingTests.swift b/Sources/Logging/Tests/LoggingTests.swift new file mode 100644 index 000000000..f5559f6ed --- /dev/null +++ b/Sources/Logging/Tests/LoggingTests.swift @@ -0,0 +1,9 @@ +import XCTest +@testable import Logging + +final class LoggingTests: XCTestCase { + func testExample() { + // Add your tests here + XCTAssertTrue(true) + } +} \ No newline at end of file diff --git a/Split.podspec b/Split.podspec index 3ba9bf6b8..2f8b6476e 100644 --- a/Split.podspec +++ b/Split.podspec @@ -19,4 +19,9 @@ This SDK is designed to work with Split, the platform for controlled rollouts, s s.source_files = 'Split/**/*.{swift}','Split/Common/Utils/JFBCrypt/*.{h,m}' s.exclude_files = 'Split/Common/Utils/Lib/*' + s.subspec 'Logging' do |ss| + ss.source_files = 'Sources/Logging/**/*' + end + + # #INJECT_SUBSPEC end diff --git a/Split.xcodeproj/project.pbxproj b/Split.xcodeproj/project.pbxproj index ee39216c0..09cf552c1 100644 --- a/Split.xcodeproj/project.pbxproj +++ b/Split.xcodeproj/project.pbxproj @@ -104,6 +104,7 @@ 3B6DEF8920EA6AE50067435E /* ConcurrentArrayQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B6DEF0620EA6AE40067435E /* ConcurrentArrayQueue.swift */; }; 3B6DEF8B20EA6AE50067435E /* DefaultFileStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B6DEF0920EA6AE40067435E /* DefaultFileStorage.swift */; }; 3BBFF93320EFA2A0005F8C26 /* SplitEventActionTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BBFF93220EFA2A0005F8C26 /* SplitEventActionTask.swift */; }; + 55F2612BD679415B346A4584 /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAE97952FA0ADED787D7ACC /* Logging.swift */; }; 5903C497210A5E0900A754B0 /* SynchronizedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5903C496210A5E0900A754B0 /* SynchronizedList.swift */; }; 5905D4CA2555F99D006DA3B1 /* GeneralInfoEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5905D4C02555F99D006DA3B1 /* GeneralInfoEntity.swift */; }; 5905D4CC2555F99D006DA3B1 /* ImpressionEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5905D4C22555F99D006DA3B1 /* ImpressionEntity.swift */; }; @@ -831,6 +832,8 @@ 5BF52DF72DE0B60700FEDAFE /* PrerequisitesMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */; }; 5BF52DF92DE4B8D400FEDAFE /* PrerequisitesMatcherTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF82DE4B8CA00FEDAFE /* PrerequisitesMatcherTest.swift */; }; 5BF52E032DE62F0500FEDAFE /* PrerequisitesMatcherMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */; }; + 88E54A26B0FA48B97D7B6AE3 /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23FD80A6B13740C2114DFA2F /* LoggingTests.swift */; }; + 945D15B2B918E1875EF7470E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB05351F643A2046D7E1EC50 /* Foundation.framework */; }; 9500D9922C56F9BA00383593 /* HostDomainFilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9912C56F9BA00383593 /* HostDomainFilterTests.swift */; }; 9500D9A92C59297400383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; 9500D9AA2C59382000383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; @@ -1547,6 +1550,7 @@ 95F7BC272C45C12700C5F2E4 /* TlsPinCheckerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F7BC262C45C12700C5F2E4 /* TlsPinCheckerMock.swift */; }; 95F7BC292C46A4C800C5F2E4 /* SecurityHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F7BC282C46A4C800C5F2E4 /* SecurityHelper.swift */; }; 95F8F06828170473009E09B1 /* multi_client_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 95F8F06728170473009E09B1 /* multi_client_test.json */; }; + B3A862C479A657597413B150 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB05351F643A2046D7E1EC50 /* Foundation.framework */; }; C514F6B62BEA6F1F00C8DF78 /* HttpParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = C514F6B52BEA6F1F00C8DF78 /* HttpParameters.swift */; }; C526DE4C2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C526DE4B2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift */; }; C52C57292EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52C57282EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift */; }; @@ -1680,6 +1684,20 @@ remoteGlobalIDString = 3B6DEE5920EA6A4E0067435E; remoteInfo = Split; }; + 6E4424077045251A1E0C26AF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 557D062442413680641861B3; + remoteInfo = Logging; + }; + ED0C4156420B8E843DF9A23B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 557D062442413680641861B3; + remoteInfo = Logging; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -1704,6 +1722,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 06B656827046A8E6AFD642E8 /* LoggingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LoggingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 23FD80A6B13740C2114DFA2F /* LoggingTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LoggingTests.swift; sourceTree = ""; }; 31AA215F3C0E2305966CD52F /* HttpStreamRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HttpStreamRequest.swift; sourceTree = ""; }; 31AA229CA74193186137A991 /* RestClient+Impressions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RestClient+Impressions.swift"; sourceTree = ""; }; 31AA22D3DA2B022F2E7F3231 /* Endpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Endpoint.swift; sourceTree = ""; }; @@ -2483,6 +2503,8 @@ 95F7BC262C45C12700C5F2E4 /* TlsPinCheckerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TlsPinCheckerMock.swift; sourceTree = ""; }; 95F7BC282C46A4C800C5F2E4 /* SecurityHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityHelper.swift; sourceTree = ""; }; 95F8F06728170473009E09B1 /* multi_client_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = multi_client_test.json; sourceTree = ""; }; + A84C2F1D387F870A3749BCE7 /* Logging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Logging.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BDAE97952FA0ADED787D7ACC /* Logging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = ""; }; C514F6B52BEA6F1F00C8DF78 /* HttpParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HttpParameters.swift; sourceTree = ""; }; C526DE4B2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImpressionsPropertiesE2ETest.swift; sourceTree = ""; }; C52C57282EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionKeyValidationIntegrationTest.swift; sourceTree = ""; }; @@ -2567,9 +2589,18 @@ C5E967562D38013000112DAC /* GeneralInfoStorageMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralInfoStorageMock.swift; sourceTree = ""; }; C5E9675E2D3849BE00112DAC /* RolloutDefinitionsCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolloutDefinitionsCache.swift; sourceTree = ""; }; C5E967612D395DAA00112DAC /* RolloutCacheManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolloutCacheManagerTest.swift; sourceTree = ""; }; + DB05351F643A2046D7E1EC50 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 020B54F29090B10B36E722EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 945D15B2B918E1875EF7470E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5620EA6A4E0067435E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2593,6 +2624,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 632973C2BFAC5B8884612D82 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B3A862C479A657597413B150 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 95825B9D271F004700A0CDAD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2611,6 +2650,34 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 09594BE53BC4B1E633601B3A /* Logging */ = { + isa = PBXGroup; + children = ( + 11D5B257E8900DEAB2408E42 /* Tests */, + BDAE97952FA0ADED787D7ACC /* Logging.swift */, + ); + name = Logging; + path = Logging; + sourceTree = ""; + }; + 11D5B257E8900DEAB2408E42 /* Tests */ = { + isa = PBXGroup; + children = ( + 23FD80A6B13740C2114DFA2F /* LoggingTests.swift */, + ); + name = Tests; + path = Tests; + sourceTree = ""; + }; + 237E67ECC8C144123A55D057 /* Sources */ = { + isa = PBXGroup; + children = ( + 09594BE53BC4B1E633601B3A /* Logging */, + ); + name = Sources; + path = Sources; + sourceTree = ""; + }; 31AA215C368D12E69FE80703 /* Streaming */ = { isa = PBXGroup; children = ( @@ -2645,6 +2712,14 @@ path = Streaming; sourceTree = ""; }; + 38B4ACD0F9962990A6B7B40C /* iOS */ = { + isa = PBXGroup; + children = ( + DB05351F643A2046D7E1EC50 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; 3B6DEE5020EA6A4D0067435E = { isa = PBXGroup; children = ( @@ -2677,6 +2752,7 @@ 3B6DEE5B20EA6A4E0067435E /* Products */, 590DF9962125F6900082B94F /* Frameworks */, 5B3C18052ED76BAE0068D623 /* SplitTests copy-Info.plist */, + 237E67ECC8C144123A55D057 /* Sources */, ); sourceTree = ""; }; @@ -2688,6 +2764,8 @@ 95825BA0271F004700A0CDAD /* Split_Split.bundle */, 95B02CA428D0BD790030EC8B /* SplitWatchOS.framework */, 5B3C18042ED76BAD0068D623 /* SplitTestsSwift6.xctest */, + A84C2F1D387F870A3749BCE7 /* Logging.framework */, + 06B656827046A8E6AFD642E8 /* LoggingTests.xctest */, ); name = Products; sourceTree = ""; @@ -3304,6 +3382,7 @@ 95B02E0928D130670030EC8B /* WatchKit.framework */, 954F9BBF2575A1AB00140B81 /* UIKit.framework */, 5946783722E1144400F94E58 /* Swifter.framework */, + 38B4ACD0F9962990A6B7B40C /* iOS */, ); name = Frameworks; sourceTree = ""; @@ -4334,6 +4413,13 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 0F5883123EAFFF015B41AEF3 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5720EA6A4E0067435E /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -4366,14 +4452,31 @@ buildRules = ( ); dependencies = ( + 626C2B9BBF3ADCABE4527521 /* PBXTargetDependency */, ); name = Split; - packageProductDependencies = ( - ); productName = Split; productReference = 3B6DEE5A20EA6A4E0067435E /* Split.framework */; productType = "com.apple.product-type.framework"; }; + 557D062442413680641861B3 /* Logging */ = { + isa = PBXNativeTarget; + buildConfigurationList = FF245C94AAE01CB254D3F6B4 /* Build configuration list for PBXNativeTarget "Logging" */; + buildPhases = ( + 0F5883123EAFFF015B41AEF3 /* Headers */, + 2723760E87F4BCE53CCD6973 /* Sources */, + 020B54F29090B10B36E722EE /* Frameworks */, + BDE7E7FFA4358D0E69C01D32 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Logging; + productName = Logging; + productReference = A84C2F1D387F870A3749BCE7 /* Logging.framework */; + productType = "com.apple.product-type.framework"; + }; 592C6AA4211B6C99002D120C /* SplitTestsSwift5 */ = { isa = PBXNativeTarget; buildConfigurationList = 592C6AAF211B6C99002D120C /* Build configuration list for PBXNativeTarget "SplitTestsSwift5" */; @@ -4389,8 +4492,6 @@ 592C6AAC211B6C99002D120C /* PBXTargetDependency */, ); name = SplitTestsSwift5; - packageProductDependencies = ( - ); productName = SplitTests; productReference = 592C6AA5211B6C99002D120C /* SplitTestsSwift5.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -4410,12 +4511,28 @@ 5B3C16352ED76BAD0068D623 /* PBXTargetDependency */, ); name = SplitTestsSwift6; - packageProductDependencies = ( - ); productName = SplitTests; productReference = 5B3C18042ED76BAD0068D623 /* SplitTestsSwift6.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 8000B2F11F535D99847B28BE /* LoggingTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2CC43A0BA4C3F04300DABA16 /* Build configuration list for PBXNativeTarget "LoggingTests" */; + buildPhases = ( + 8D531141D7BF6F4CE4BB1F42 /* Sources */, + 632973C2BFAC5B8884612D82 /* Frameworks */, + FD5894504B3665533EF83AF7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3B70B5C59A2844E0D2897B9C /* PBXTargetDependency */, + ); + name = LoggingTests; + productName = LoggingTests; + productReference = 06B656827046A8E6AFD642E8 /* LoggingTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 95825B9F271F004700A0CDAD /* Split_Split */ = { isa = PBXNativeTarget; buildConfigurationList = 95825BA5271F004800A0CDAD /* Build configuration list for PBXNativeTarget "Split_Split" */; @@ -4488,8 +4605,6 @@ Base, ); mainGroup = 3B6DEE5020EA6A4D0067435E; - packageReferences = ( - ); productRefGroup = 3B6DEE5B20EA6A4E0067435E /* Products */; projectDirPath = ""; projectRoot = ""; @@ -4499,6 +4614,8 @@ 5B3C16342ED76BAD0068D623 /* SplitTestsSwift6 */, 95825B9F271F004700A0CDAD /* Split_Split */, 95B02CA328D0BD790030EC8B /* SplitWatchOS */, + 557D062442413680641861B3 /* Logging */, + 8000B2F11F535D99847B28BE /* LoggingTests */, ); }; /* End PBXProject section */ @@ -4720,6 +4837,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BDE7E7FFA4358D0E69C01D32 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FD5894504B3665533EF83AF7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -4743,6 +4874,14 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2723760E87F4BCE53CCD6973 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55F2612BD679415B346A4584 /* Logging.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5520EA6A4E0067435E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -5873,6 +6012,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 8D531141D7BF6F4CE4BB1F42 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 88E54A26B0FA48B97D7B6AE3 /* LoggingTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 95825B9C271F004700A0CDAD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -6251,6 +6398,12 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 3B70B5C59A2844E0D2897B9C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Logging; + target = 557D062442413680641861B3 /* Logging */; + targetProxy = 6E4424077045251A1E0C26AF /* PBXContainerItemProxy */; + }; 592C6AAC211B6C99002D120C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3B6DEE5920EA6A4E0067435E /* Split */; @@ -6261,9 +6414,97 @@ target = 3B6DEE5920EA6A4E0067435E /* Split */; targetProxy = 5B3C16362ED76BAD0068D623 /* PBXContainerItemProxy */; }; + 626C2B9BBF3ADCABE4527521 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Logging; + target = 557D062442413680641861B3 /* Logging */; + targetProxy = ED0C4156420B8E843DF9A23B /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 1E6BFABC4C3C513B159FB9B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 3809C6CC6901B64FF7C40F6F /* Debug-Swift6 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = "Debug-Swift6"; + }; + 3961E0B6BAE2C41629EBA80C /* Debug-Swift5 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = "Debug-Swift5"; + }; 3B6DEE6020EA6A4E0067435E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6490,6 +6731,33 @@ }; name = Release; }; + 3FAFFF1BCBD47F87A6574701 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; 592C6AAD211B6C99002D120C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6600,6 +6868,25 @@ }; name = Release; }; + 8BC296B950AC84FEFBE7C76F /* Debug-Swift5 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = "Debug-Swift5"; + }; 95825BA3271F004800A0CDAD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -7211,9 +7498,78 @@ }; name = "Debug-Swift6"; }; + DFA8FF5A377EC1B5BDA8B991 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = Debug; + }; + E19FEC1F2F10CDEDA6DA853D /* Debug-Swift6 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = "Debug-Swift6"; + }; + FA374EC131AEDC301A0339CA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2CC43A0BA4C3F04300DABA16 /* Build configuration list for PBXNativeTarget "LoggingTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA374EC131AEDC301A0339CA /* Release */, + DFA8FF5A377EC1B5BDA8B991 /* Debug */, + 8BC296B950AC84FEFBE7C76F /* Debug-Swift5 */, + E19FEC1F2F10CDEDA6DA853D /* Debug-Swift6 */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 3B6DEE5420EA6A4D0067435E /* Build configuration list for PBXProject "Split" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -7280,6 +7636,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FF245C94AAE01CB254D3F6B4 /* Build configuration list for PBXNativeTarget "Logging" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1E6BFABC4C3C513B159FB9B9 /* Release */, + 3FAFFF1BCBD47F87A6574701 /* Debug */, + 3961E0B6BAE2C41629EBA80C /* Debug-Swift5 */, + 3809C6CC6901B64FF7C40F6F /* Debug-Swift6 */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCVersionGroup section */ diff --git a/Split/_KwiftDependencies.swift b/Split/_KwiftDependencies.swift new file mode 100644 index 000000000..4803cf161 --- /dev/null +++ b/Split/_KwiftDependencies.swift @@ -0,0 +1,6 @@ +/// Auto-generated by Kwift to verify dependency wiring at compile time. +private enum _KwiftDependencies { + static func link() { + _ = LoggingInternal() + } +} \ No newline at end of file From 4898e7a4c72b6f878fa6d694c317c4c28bce0928 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 22:57:31 -0300 Subject: [PATCH 02/18] Move Logger to Logging (git mv) --- {Split/Common/Utils => Sources/Logging}/Logger.swift | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Split/Common/Utils => Sources/Logging}/Logger.swift (100%) diff --git a/Split/Common/Utils/Logger.swift b/Sources/Logging/Logger.swift similarity index 100% rename from Split/Common/Utils/Logger.swift rename to Sources/Logging/Logger.swift From 3929de13d82fdd504c5c9f840f41d0bb2fe85a80 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 22:56:04 -0300 Subject: [PATCH 03/18] Logging module extracted --- Package.swift | 8 +- Sources/Logging/DateProvider.swift | 31 +++++ Sources/Logging/LogLevel.swift | 36 ++++++ Sources/Logging/LogPrinter.swift | 22 ++++ Sources/Logging/Logger.swift | 112 ++++------------- Sources/Logging/Logging.swift | 10 +- Sources/Logging/Tests/LogPrinterStub.swift | 30 +++++ Sources/Logging/Tests/LoggingTests.swift | 116 +++++++++++++++++- Sources/Logging/TimeChecker.swift | 66 ++++++++++ Split.xcodeproj/project.pbxproj | 27 +++- Split/Api/CertificatePinningConfig.swift | 1 + Split/Api/DefaultSplitClient.swift | 14 ++- Split/Api/DefaultSplitFactory.swift | 1 + Split/Api/DefaultSplitFactoryBuilder.swift | 1 + Split/Api/DefaultSplitManager.swift | 1 + Split/Api/EventsTracker.swift | 1 + Split/Api/FilterBuilder.swift | 1 + Split/Api/FlagSetsValidator.swift | 1 + Split/Api/LocalhostSplitClient.swift | 12 +- Split/Api/LocalhostSplitFactory.swift | 1 + Split/Api/RolloutCacheConfiguration.swift | 1 + Split/Api/SplitClientConfig.swift | 22 ++-- Split/Api/SplitClientManager.swift | 1 + Split/Api/SplitDatabaseHelper.swift | 1 + Split/Api/SplitLogLevel.swift | 39 ++++++ Split/Api/SyncConfig.swift | 1 + Split/Api/UserConsentManager.swift | 1 + .../Extensions/Array+DynamicCodable.swift | 1 + .../Dictionary+DynamicCodable.swift | 1 + Split/Common/Extensions/String+Utils.swift | 1 + Split/Common/Utils/Cipher.swift | 1 + Split/Common/Utils/CompressionUtil.swift | 1 + Split/Common/Utils/DbCipher.swift | 1 + Split/Common/Utils/DbEncryptionManager.swift | 1 + Split/Common/Utils/FileUtil.swift | 1 + Split/Common/Utils/InfoUtils.swift | 1 + Split/Common/Utils/NotificationsHelper.swift | 1 + Split/Common/Utils/ThreadUtils.swift | 1 + .../Common/Validators/PropertyValidator.swift | 1 + .../Validators/ValidatorMessageLogger.swift | 1 + Split/Engine/DefaultTreatmentManager.swift | 1 + Split/Engine/Evaluator.swift | 1 + .../FallbackSanitizer.swift | 1 + .../FallbackTreatments.swift | 1 + Split/Engine/Hashing/Murmur64x128.swift | 1 + Split/Events/SplitEventActionTask.swift | 1 + Split/Events/SplitEventsManager.swift | 1 + .../FetcherEngine/HttpMySegmentsFetcher.swift | 1 + Split/FetcherEngine/HttpSplitFetcher.swift | 1 + .../Recorder/EventsRecorderWorker.swift | 1 + .../ImpressionsCountRecorderWorker.swift | 1 + .../Recorder/ImpressionsRecorderWorker.swift | 1 + .../TelemetryConfigRecorderWorker.swift | 1 + .../Recorder/TelemetryStatsRecorder.swift | 1 + .../TelemetryStatsRecorderWorker.swift | 1 + .../Recorder/UniqueKeysRecorderWorker.swift | 1 + .../Refresh/BackgroundSyncWorker.swift | 1 + .../Refresh/PeriodicSyncWorker.swift | 1 + .../Refresh/RetryableSegmentsSyncWorker.swift | 1 + .../Refresh/RetryableSyncWorker.swift | 1 + .../Refresh/SplitBgSynchronizer.swift | 1 + .../Refresh/SplitsSyncHelper.swift | 1 + Split/FetcherEngine/SyncHelper.swift | 1 + .../Initialization/RolloutCacheManager.swift | 1 + Split/Localhost/LocalhostClientManager.swift | 1 + Split/Localhost/LocalhostFileDataSource.swift | 1 + Split/Localhost/LocalhostSplitsParser.swift | 1 + Split/Localhost/LocalhostSynchronizer.swift | 1 + .../SpaceDelimitedLocalhostSplitsParser.swift | 1 + .../Localhost/YamlLocalhostSplitsParser.swift | 1 + .../Matchers/InRuleBasedSegmentMatcher.swift | 1 + Split/Matchers/PrerequisitesMatcher.swift | 1 + .../Semver/BetweenSemverMatcher.swift | 1 + .../Semver/EqualToSemverMatcher.swift | 1 + .../GreaterThanOrEqualToSemverMatcher.swift | 1 + .../LessThanOrEqualToSemverMatcher.swift | 1 + Split/Matchers/Semver/Semver.swift | 1 + Split/Network/HttpClient/HttpClient.swift | 1 + Split/Network/HttpClient/HttpRequest.swift | 1 + .../HttpClient/HttpRequestManager.swift | 1 + .../OutdatedSplitProxyHandler.swift | 1 + .../RestClient/RestClient+Impressions.swift | 1 + .../RestClient+ImpressionsCount.swift | 1 + .../RestClient+TelemetryConfig.swift | 1 + .../RestClient+TelemetryStats.swift | 1 + .../RestClient/RestClient+TrackEvents.swift | 1 + .../RestClient/RestClient+UniqueKeys.swift | 1 + Split/Network/RestClient/RestClient.swift | 1 + Split/Network/Security/TlsPinChecker.swift | 1 + .../Streaming/BackoffCounterTimer.swift | 1 + .../DefaultSseNotificationParser.swift | 1 + Split/Network/Streaming/JwtTokenParser.swift | 1 + .../Streaming/NotificationManagerKeeper.swift | 1 + .../Streaming/PushNotificationManager.swift | 1 + Split/Network/Streaming/SseClient.swift | 1 + .../Streaming/SseConnectionHandler.swift | 1 + Split/Network/Streaming/SseHandler.swift | 1 + .../Streaming/SseNotificationProcessor.swift | 1 + .../Streaming/SyncSegmentsUpdateWorker.swift | 1 + .../Network/Streaming/SyncUpdateWorker.swift | 1 + .../Sync/FeatureFlagsSynchronizer.swift | 1 + Split/Network/Sync/ImpressionsTracker.swift | 1 + Split/Network/Sync/SyncManager.swift | 1 + Split/Secure/SecureDataStore.swift | 1 + Split/Storage/Attributes/AttributesDao.swift | 1 + Split/Storage/CoreDataContextBuilder.swift | 1 + Split/Storage/CoreDataHelper.swift | 1 + Split/Storage/DefaultFileStorage.swift | 1 + Split/Storage/Events/EventDao.swift | 1 + Split/Storage/Events/EventsStorage.swift | 1 + .../Storage/Global/GlobalSecureStorage.swift | 1 + .../HashedImpressionStorage.swift | 1 + Split/Storage/Impressions/ImpressionDao.swift | 1 + .../Impressions/ImpressionsCountDao.swift | 1 + .../Storage/Impressions/ImpressionsMode.swift | 1 + .../Impressions/ImpressionsStorage.swift | 1 + Split/Storage/MySegments/MySegmentsDao.swift | 1 + Split/Storage/PersistenceBreaker.swift | 1 + .../RuleBasedSegmentDao.swift | 1 + .../RuleBasedSegmentsDecoder.swift | 1 + .../RuleBasedSegmentsEncoder.swift | 1 + .../Splits/PersistentSplitsStorage.swift | 1 + Split/Storage/Splits/SplitDao.swift | 1 + Split/Storage/Splits/SplitsDecoder.swift | 1 + Split/Storage/Splits/SplitsEncoder.swift | 1 + Split/Storage/Splits/SplitsStorage.swift | 1 + Split/Storage/UniqueKeys/UniqueKeyDao.swift | 1 + Split/_KwiftDependencies.swift | 5 +- SplitTests/Fake/LogPrinterStub.swift | 1 + SplitTests/Integration/Api/LoggerTest.swift | 19 +-- 130 files changed, 548 insertions(+), 135 deletions(-) create mode 100644 Sources/Logging/DateProvider.swift create mode 100644 Sources/Logging/LogLevel.swift create mode 100644 Sources/Logging/LogPrinter.swift create mode 100644 Sources/Logging/Tests/LogPrinterStub.swift create mode 100644 Sources/Logging/TimeChecker.swift diff --git a/Package.swift b/Package.swift index ac690b459..6fed8c183 100644 --- a/Package.swift +++ b/Package.swift @@ -11,18 +11,20 @@ let package = Package( targets: [ .target( name: "Split", + dependencies: ["Logging"], path: "Split", exclude: [ "Common/Yaml/LICENSE", "Info.plist", "Split.h" - ], - dependencies: ["Logging"] + ] ), .target( name: "Logging", - dependencies: [] + dependencies: [], + path: "Sources/Logging", + exclude: ["Tests", "README.md"] ), .testTarget( name: "LoggingTests", diff --git a/Sources/Logging/DateProvider.swift b/Sources/Logging/DateProvider.swift new file mode 100644 index 000000000..729c8eda7 --- /dev/null +++ b/Sources/Logging/DateProvider.swift @@ -0,0 +1,31 @@ +// +// DateProvider.swift +// Logging +// +// Created by Split SDK Team +// + +import Foundation + +/// Protocol for providing date/time functionality to the logging system +public protocol DateProvider { + /// Returns current time in milliseconds since epoch + func nowMillis() -> Int64 + + /// Returns a formatted timestamp string for logging + func nowLabel() -> String +} + +/// Placeholder implementation that returns hardcoded values +/// This should be replaced by a real implementation from the consuming module +public struct PlaceholderDateProvider: DateProvider { + public init() {} + + public func nowMillis() -> Int64 { + return 0 + } + + public func nowLabel() -> String { + return "00-00-0000 00:00:00.000" + } +} diff --git a/Sources/Logging/LogLevel.swift b/Sources/Logging/LogLevel.swift new file mode 100644 index 000000000..a010080f2 --- /dev/null +++ b/Sources/Logging/LogLevel.swift @@ -0,0 +1,36 @@ +// +// LogLevel.swift +// Logging +// +// Created by Split SDK Team +// + +import Foundation + +/// Log level enumeration for the Logging module +public enum LogLevel: String { + case verbose = "VERBOSE" + case debug = "DEBUG" + case info = "INFO" + case warning = "WARNING" + case error = "ERROR" + case none = "NONE" + + /// Returns the numeric order of the log level (lower = more verbose) + public func order() -> Int { + switch self { + case .verbose: + return 0 + case .debug: + return 1 + case .info: + return 2 + case .warning: + return 3 + case .error: + return 4 + case .none: + return 5 + } + } +} diff --git a/Sources/Logging/LogPrinter.swift b/Sources/Logging/LogPrinter.swift new file mode 100644 index 000000000..611b86aa9 --- /dev/null +++ b/Sources/Logging/LogPrinter.swift @@ -0,0 +1,22 @@ +// +// LogPrinter.swift +// Logging +// +// Created by Split SDK Team +// + +import Foundation + +/// Protocol to enable testing for Logger class +public protocol LogPrinter { + func stdout(_ items: Any...) +} + +/// Default implementation that prints to stdout +public class DefaultLogPrinter: LogPrinter { + public init() {} + + public func stdout(_ items: Any...) { + print(items) + } +} diff --git a/Sources/Logging/Logger.swift b/Sources/Logging/Logger.swift index 0bf30d2c1..8293d0594 100644 --- a/Sources/Logging/Logger.swift +++ b/Sources/Logging/Logger.swift @@ -1,118 +1,56 @@ // // Logger.swift -// Split +// Logging // -// Created by Sebastian Arrubia on 3/5/18. +// Created by Split SDK Team // import Foundation -struct TimeChecker { - - #if swift(>=6.0) - nonisolated(unsafe) private static var startTime: Int64 = 0 - #else - private static var startTime: Int64 = 0 - #endif - - private static let tag = "[SPTPRF] " - private static let showTimestamp = true - private static let showSinceMsg = true - static func start() { - startTime = Date.nowMillis() - Logger.v("\(tag) TimeChecker started at: \(startTime)") - } - - static func logInterval(_ msg: String) { - let now = Date.nowMillis() - let interval = now - startTime - Logger.v("\(tag) \(msg) \(formatTimestamp(now)) \(formatIntervalSinceStart(interval))") - } - - static func logTime(_ msg: String) { - Logger.v("\(tag) \(msg) \(formatIntervalSinceStart(Date.nowMillis()))") - } - - static func logInterval(_ msg: String, startTime: Int64) { - Logger.v("\(tag) \(msg) \(Date.nowMillis() - startTime) ms \(formatTimestamp(Date.nowMillis()))") - } - - static func formatInterval(_ interval: Int64) -> String { - if !showSinceMsg { - return "\(interval)" - } - return "Time since instanciation start \(interval) ms" - } - - static func formatIntervalSinceStart(_ interval: Int64) -> String { - if !showSinceMsg { - return "\(interval)" - } - return "\(interval) ms since instanciation start" - } - - static func formatTimestamp(_ now: Int64) -> String { - if !showTimestamp { - return "" - } - return "at \(now)" - } -} - -// Protocol to enable testing for Logger class -protocol LogPrinter { - func stdout(_ items: Any...) -} - -class DefaultLogPrinter: LogPrinter { - func stdout(_ items: Any...) { - print(items) - } -} - -class Logger: @unchecked Sendable { - var printer: LogPrinter = DefaultLogPrinter() +/// Main logger class for the Logging module +public class Logger: @unchecked Sendable { + public var printer: LogPrinter = DefaultLogPrinter() + public var dateProvider: DateProvider = PlaceholderDateProvider() private let tag: String = "SplitSDK" - - var level: SplitLogLevel = .none - - static let shared: Logger = { + + public var level: LogLevel = .none + + public static let shared: Logger = { return Logger() }() - + private init() {} - - private func log(level: SplitLogLevel, msg: String, _ ctx: Any ...) { - + + private func log(level: LogLevel, msg: String, _ ctx: Any ...) { if level.order() < self.level.order() { return } - - let timeLabel = Date.nowLabel() + + let timeLabel = dateProvider.nowLabel() if ctx.count == 0 { printer.stdout(timeLabel, level.rawValue, tag, msg) } else { printer.stdout(timeLabel, level.rawValue, tag, msg, ctx[0]) } } - - static func v(_ message: String, _ context: Any ...) { + + public static func v(_ message: String, _ context: Any ...) { shared.log(level: .verbose, msg: message, context) } - - static func d(_ message: String, _ context: Any ...) { + + public static func d(_ message: String, _ context: Any ...) { shared.log(level: .debug, msg: message, context) } - - static func i(_ message: String, _ context: Any ...) { + + public static func i(_ message: String, _ context: Any ...) { shared.log(level: .info, msg: message, context) } - - static func w(_ message: String, _ context: Any ...) { + + public static func w(_ message: String, _ context: Any ...) { shared.log(level: .warning, msg: message, context) } - - static func e(_ message: String, _ context: Any ...) { + + public static func e(_ message: String, _ context: Any ...) { shared.log(level: .error, msg: message, context) } } diff --git a/Sources/Logging/Logging.swift b/Sources/Logging/Logging.swift index d25f965e4..758eedce1 100644 --- a/Sources/Logging/Logging.swift +++ b/Sources/Logging/Logging.swift @@ -1,8 +1,2 @@ -import Foundation - -public struct LoggingInternal { - public init() {} - public func action() { - print("Logging ready.") - } -} \ No newline at end of file +// Logging module - Core logging functionality extracted from Split SDK +// This module provides Logger, LogLevel, LogPrinter, TimeChecker, and DateProvider \ No newline at end of file diff --git a/Sources/Logging/Tests/LogPrinterStub.swift b/Sources/Logging/Tests/LogPrinterStub.swift new file mode 100644 index 000000000..0dbf58bc0 --- /dev/null +++ b/Sources/Logging/Tests/LogPrinterStub.swift @@ -0,0 +1,30 @@ +// +// LogPrinterStub.swift +// LoggingTests +// +// Created by Javier Avrudsky on 08-Jul-2022. +// Copyright © 2022 Split. All rights reserved. +// + +import Foundation +@testable import Logging + +class LogPrinterStub: LogPrinter, @unchecked Sendable { + + private(set) var logs = [String]() + + private let queue = DispatchQueue(label: "Logging.LogPrinterStub", + target: .global()) + + func stdout(_ items: Any...) { + queue.sync { + self.logs.append(items.map { "\($0)" }.joined(separator: ",")) + } + } + + func clear() { + queue.sync { + self.logs.removeAll() + } + } +} diff --git a/Sources/Logging/Tests/LoggingTests.swift b/Sources/Logging/Tests/LoggingTests.swift index f5559f6ed..e73f85b53 100644 --- a/Sources/Logging/Tests/LoggingTests.swift +++ b/Sources/Logging/Tests/LoggingTests.swift @@ -1,9 +1,113 @@ -import XCTest +// +// LoggingTests.swift +// LoggingTests +// +// Created by Javier Avrudsky on 08-Jul-2022. +// Copyright © 2022 Split. All rights reserved. +// + +import Foundation @testable import Logging -final class LoggingTests: XCTestCase { - func testExample() { - // Add your tests here - XCTAssertTrue(true) +import XCTest + +class LoggingTests : XCTestCase { + + let printer = LogPrinterStub() + + override func setUp() { + printer.clear() + Logger.shared.printer = printer + Logger.shared.dateProvider = PlaceholderDateProvider() + } + + func testNone() { + Logger.shared.level = .none + + logAll() + + XCTAssertFalse(isLogged(level: .verbose)) + XCTAssertFalse(isLogged(level: .debug)) + XCTAssertFalse(isLogged(level: .info)) + XCTAssertFalse(isLogged(level: .warning)) + XCTAssertFalse(isLogged(level: .error)) + } + + func testVerbose() { + Logger.shared.level = .verbose + + logAll() + + XCTAssertTrue(isLogged(level: .verbose)) + XCTAssertTrue(isLogged(level: .debug)) + XCTAssertTrue(isLogged(level: .info)) + XCTAssertTrue(isLogged(level: .warning)) + XCTAssertTrue(isLogged(level: .error)) + } + + func testDebug() { + Logger.shared.level = .debug + + logAll() + + XCTAssertFalse(isLogged(level: .verbose)) + XCTAssertTrue(isLogged(level: .debug)) + XCTAssertTrue(isLogged(level: .info)) + XCTAssertTrue(isLogged(level: .warning)) + XCTAssertTrue(isLogged(level: .error)) + } + + func testInfo() { + Logger.shared.level = .info + + logAll() + + XCTAssertFalse(isLogged(level: .verbose)) + XCTAssertFalse(isLogged(level: .debug)) + XCTAssertTrue(isLogged(level: .info)) + XCTAssertTrue(isLogged(level: .warning)) + XCTAssertTrue(isLogged(level: .error)) + } + + func testWarning() { + Logger.shared.level = .warning + + logAll() + + XCTAssertFalse(isLogged(level: .verbose)) + XCTAssertFalse(isLogged(level: .debug)) + XCTAssertFalse(isLogged(level: .info)) + XCTAssertTrue(isLogged(level: .warning)) + XCTAssertTrue(isLogged(level: .error)) + } + + func testError() { + Logger.shared.level = .error + + logAll() + + XCTAssertFalse(isLogged(level: .verbose)) + XCTAssertFalse(isLogged(level: .debug)) + XCTAssertFalse(isLogged(level: .info)) + XCTAssertFalse(isLogged(level: .warning)) + XCTAssertTrue(isLogged(level: .error)) + } + + private func isLogged(level: LogLevel) -> Bool { + return printer.logs.filter { $0.contains("\(level.rawValue)") }.count > 0 + } + + private func logAll() { + Logger.v("log") + Logger.d("log") + Logger.i("log") + Logger.w("log") + Logger.e("log") + } + + override func tearDown() { + Logger.shared.printer = DefaultLogPrinter() + Logger.shared.dateProvider = PlaceholderDateProvider() + printer.clear() } -} \ No newline at end of file +} diff --git a/Sources/Logging/TimeChecker.swift b/Sources/Logging/TimeChecker.swift new file mode 100644 index 000000000..3778f5ab2 --- /dev/null +++ b/Sources/Logging/TimeChecker.swift @@ -0,0 +1,66 @@ +// +// TimeChecker.swift +// Logging +// +// Created by Split SDK Team +// + +import Foundation + +/// Utility for checking and logging time intervals +public struct TimeChecker { + + #if swift(>=6.0) + nonisolated(unsafe) private static var startTime: Int64 = 0 + #else + private static var startTime: Int64 = 0 + #endif + + private static let tag = "[SPTPRF] " + private static let showTimestamp = true + private static let showSinceMsg = true + + public static func start(dateProvider: DateProvider? = nil) { + let provider = dateProvider ?? Logger.shared.dateProvider + startTime = provider.nowMillis() + Logger.v("\(tag) TimeChecker started at: \(startTime)") + } + + public static func logInterval(_ msg: String, dateProvider: DateProvider? = nil) { + let provider = dateProvider ?? Logger.shared.dateProvider + let now = provider.nowMillis() + let interval = now - startTime + Logger.v("\(tag) \(msg) \(formatTimestamp(now)) \(formatIntervalSinceStart(interval))") + } + + public static func logTime(_ msg: String, dateProvider: DateProvider? = nil) { + let provider = dateProvider ?? Logger.shared.dateProvider + Logger.v("\(tag) \(msg) \(formatIntervalSinceStart(provider.nowMillis()))") + } + + public static func logInterval(_ msg: String, startTime: Int64, dateProvider: DateProvider? = nil) { + let provider = dateProvider ?? Logger.shared.dateProvider + Logger.v("\(tag) \(msg) \(provider.nowMillis() - startTime) ms \(formatTimestamp(provider.nowMillis()))") + } + + public static func formatInterval(_ interval: Int64) -> String { + if !showSinceMsg { + return "\(interval)" + } + return "Time since instanciation start \(interval) ms" + } + + public static func formatIntervalSinceStart(_ interval: Int64) -> String { + if !showSinceMsg { + return "\(interval)" + } + return "\(interval) ms since instanciation start" + } + + public static func formatTimestamp(_ now: Int64) -> String { + if !showTimestamp { + return "" + } + return "at \(now)" + } +} diff --git a/Split.xcodeproj/project.pbxproj b/Split.xcodeproj/project.pbxproj index 09cf552c1..287be9576 100644 --- a/Split.xcodeproj/project.pbxproj +++ b/Split.xcodeproj/project.pbxproj @@ -1649,6 +1649,12 @@ C5A7D5572DDBD4380081D190 /* split_changes_rbs.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A7D5562DDBD4280081D190 /* split_changes_rbs.json */; }; C5A7D5592DDBD7A30081D190 /* OutdatedProxyIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5A7D5582DDBD7A30081D190 /* OutdatedProxyIntegrationTest.swift */; }; C5A7D5612DDF88BA0081D190 /* RuleBasedSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C539CAB52D88C1F10050C732 /* RuleBasedSegment.swift */; }; + C5B9D4B82F259BD9000D1C11 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4B42F259BD9000D1C11 /* Logger.swift */; }; + C5B9D4B92F259BD9000D1C11 /* LogPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4B62F259BD9000D1C11 /* LogPrinter.swift */; }; + C5B9D4BA2F259BD9000D1C11 /* DateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4B32F259BD9000D1C11 /* DateProvider.swift */; }; + C5B9D4BB2F259BD9000D1C11 /* LogLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4B52F259BD9000D1C11 /* LogLevel.swift */; }; + C5B9D4BC2F259BD9000D1C11 /* TimeChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4B72F259BD9000D1C11 /* TimeChecker.swift */; }; + C5B9D4BE2F259BEA000D1C11 /* LogPrinterStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5B9D4BD2F259BEA000D1C11 /* LogPrinterStub.swift */; }; C5BD1E4C2D11A993008EF198 /* DecoratedImpression.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5BD1E4B2D11A98E008EF198 /* DecoratedImpression.swift */; }; C5BD1E4D2D11A993008EF198 /* DecoratedImpression.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5BD1E4B2D11A98E008EF198 /* DecoratedImpression.swift */; }; C5BD1E4F2D130EAF008EF198 /* ImpressionsToggleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5BD1E4E2D130EA7008EF198 /* ImpressionsToggleTest.swift */; }; @@ -2577,6 +2583,12 @@ C5A7D5522DD672CF0081D190 /* RuleBasedSegmentsIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleBasedSegmentsIntegrationTest.swift; sourceTree = ""; }; C5A7D5562DDBD4280081D190 /* split_changes_rbs.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = split_changes_rbs.json; sourceTree = ""; }; C5A7D5582DDBD7A30081D190 /* OutdatedProxyIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutdatedProxyIntegrationTest.swift; sourceTree = ""; }; + C5B9D4B32F259BD9000D1C11 /* DateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateProvider.swift; sourceTree = ""; }; + C5B9D4B42F259BD9000D1C11 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; + C5B9D4B52F259BD9000D1C11 /* LogLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogLevel.swift; sourceTree = ""; }; + C5B9D4B62F259BD9000D1C11 /* LogPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogPrinter.swift; sourceTree = ""; }; + C5B9D4B72F259BD9000D1C11 /* TimeChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeChecker.swift; sourceTree = ""; }; + C5B9D4BD2F259BEA000D1C11 /* LogPrinterStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogPrinterStub.swift; sourceTree = ""; }; C5BD1E4B2D11A98E008EF198 /* DecoratedImpression.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecoratedImpression.swift; sourceTree = ""; }; C5BD1E4E2D130EA7008EF198 /* ImpressionsToggleTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImpressionsToggleTest.swift; sourceTree = ""; }; C5BD1E512D130FB6008EF198 /* splitchanges_toggle.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = splitchanges_toggle.json; sourceTree = ""; }; @@ -2653,19 +2665,23 @@ 09594BE53BC4B1E633601B3A /* Logging */ = { isa = PBXGroup; children = ( + C5B9D4B32F259BD9000D1C11 /* DateProvider.swift */, + C5B9D4B42F259BD9000D1C11 /* Logger.swift */, + C5B9D4B52F259BD9000D1C11 /* LogLevel.swift */, + C5B9D4B62F259BD9000D1C11 /* LogPrinter.swift */, + C5B9D4B72F259BD9000D1C11 /* TimeChecker.swift */, 11D5B257E8900DEAB2408E42 /* Tests */, BDAE97952FA0ADED787D7ACC /* Logging.swift */, ); - name = Logging; path = Logging; sourceTree = ""; }; 11D5B257E8900DEAB2408E42 /* Tests */ = { isa = PBXGroup; children = ( + C5B9D4BD2F259BEA000D1C11 /* LogPrinterStub.swift */, 23FD80A6B13740C2114DFA2F /* LoggingTests.swift */, ); - name = Tests; path = Tests; sourceTree = ""; }; @@ -2674,7 +2690,6 @@ children = ( 09594BE53BC4B1E633601B3A /* Logging */, ); - name = Sources; path = Sources; sourceTree = ""; }; @@ -4879,6 +4894,11 @@ buildActionMask = 2147483647; files = ( 55F2612BD679415B346A4584 /* Logging.swift in Sources */, + C5B9D4B82F259BD9000D1C11 /* Logger.swift in Sources */, + C5B9D4B92F259BD9000D1C11 /* LogPrinter.swift in Sources */, + C5B9D4BA2F259BD9000D1C11 /* DateProvider.swift in Sources */, + C5B9D4BB2F259BD9000D1C11 /* LogLevel.swift in Sources */, + C5B9D4BC2F259BD9000D1C11 /* TimeChecker.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6017,6 +6037,7 @@ buildActionMask = 2147483647; files = ( 88E54A26B0FA48B97D7B6AE3 /* LoggingTests.swift in Sources */, + C5B9D4BE2F259BEA000D1C11 /* LogPrinterStub.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Split/Api/CertificatePinningConfig.swift b/Split/Api/CertificatePinningConfig.swift index f4d7ac0d9..483e6755c 100644 --- a/Split/Api/CertificatePinningConfig.swift +++ b/Split/Api/CertificatePinningConfig.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging public typealias CertificatePinningFailureHandler = @Sendable(String) -> Void public typealias CertificatePinningStatusHandler = @Sendable(String, CertificatePinningStatus, String) -> Void diff --git a/Split/Api/DefaultSplitClient.swift b/Split/Api/DefaultSplitClient.swift index 625c06265..e4dfe1a93 100644 --- a/Split/Api/DefaultSplitClient.swift +++ b/Split/Api/DefaultSplitClient.swift @@ -2,6 +2,8 @@ // Modified by Natalia Stele on 11/10/17. import Foundation +import Logging +import Logging typealias DestroyHandler = () -> Void @@ -91,16 +93,16 @@ extension DefaultSplitClient { // MARK: Events Listeners with Medatadata @objc public func addEventListener(listener: SplitEventListener) { - if let l = listener.onSdkReady { - registerEvent(.sdkReady, action: l) + if let listenerBlock = listener.onSdkReady { + registerEvent(.sdkReady, action: listenerBlock) } - if let l = listener.onSdkReadyFromCache { - registerEvent(.sdkReadyFromCache, action: l) + if let listenerBlock = listener.onSdkReadyFromCache { + registerEvent(.sdkReadyFromCache, action: listenerBlock) } - if let l = listener.onSdkUpdate { - registerEvent(.sdkUpdated, action: l) + if let listenerBlock = listener.onSdkUpdate { + registerEvent(.sdkUpdated, action: listenerBlock) } } diff --git a/Split/Api/DefaultSplitFactory.swift b/Split/Api/DefaultSplitFactory.swift index 3e36819cf..592954093 100644 --- a/Split/Api/DefaultSplitFactory.swift +++ b/Split/Api/DefaultSplitFactory.swift @@ -5,6 +5,7 @@ // Created by Brian Sztamfater on 27/9/17. import Foundation +import Logging /** Default implementation of SplitManager protocol diff --git a/Split/Api/DefaultSplitFactoryBuilder.swift b/Split/Api/DefaultSplitFactoryBuilder.swift index ec0123524..dad3f47b2 100644 --- a/Split/Api/DefaultSplitFactoryBuilder.swift +++ b/Split/Api/DefaultSplitFactoryBuilder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Default implementation of factory builder. diff --git a/Split/Api/DefaultSplitManager.swift b/Split/Api/DefaultSplitManager.swift index 7d4657cfd..525518214 100644 --- a/Split/Api/DefaultSplitManager.swift +++ b/Split/Api/DefaultSplitManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Default implementation of SplitManager protocol diff --git a/Split/Api/EventsTracker.swift b/Split/Api/EventsTracker.swift index b02654ea4..d273a5fd8 100644 --- a/Split/Api/EventsTracker.swift +++ b/Split/Api/EventsTracker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol EventsTracker: AnyObject { var isTrackingEnabled: Bool { get set } diff --git a/Split/Api/FilterBuilder.swift b/Split/Api/FilterBuilder.swift index dd5bae79a..e9c2bdcfc 100644 --- a/Split/Api/FilterBuilder.swift +++ b/Split/Api/FilterBuilder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging enum FilterError: Error { case maxFilterValuesExceded(message: String) diff --git a/Split/Api/FlagSetsValidator.swift b/Split/Api/FlagSetsValidator.swift index 8d821fc63..4b6a91fc1 100644 --- a/Split/Api/FlagSetsValidator.swift +++ b/Split/Api/FlagSetsValidator.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol FlagSetsValidator { func validateOnEvaluation(_ values: [String], calledFrom method: String, setsInFilter: [String]) -> [String] diff --git a/Split/Api/LocalhostSplitClient.swift b/Split/Api/LocalhostSplitClient.swift index 094e4f2c8..92e5012ef 100644 --- a/Split/Api/LocalhostSplitClient.swift +++ b/Split/Api/LocalhostSplitClient.swift @@ -145,16 +145,16 @@ public final class LocalhostSplitClient: NSObject, SplitClient { // MARK: Events Listeners with Medatadata @objc public func addEventListener(listener: SplitEventListener) { - if let l = listener.onSdkReady { - registerEvent(.sdkReady, action: l) + if let listenerBlock = listener.onSdkReady { + registerEvent(.sdkReady, action: listenerBlock) } - if let l = listener.onSdkReadyFromCache { - registerEvent(.sdkReadyFromCache, action: l) + if let listenerBlock = listener.onSdkReadyFromCache { + registerEvent(.sdkReadyFromCache, action: listenerBlock) } - if let l = listener.onSdkUpdate { - registerEvent(.sdkUpdated, action: l) + if let listenerBlock = listener.onSdkUpdate { + registerEvent(.sdkUpdated, action: listenerBlock) } } diff --git a/Split/Api/LocalhostSplitFactory.swift b/Split/Api/LocalhostSplitFactory.swift index 1347514fc..29794bde4 100644 --- a/Split/Api/LocalhostSplitFactory.swift +++ b/Split/Api/LocalhostSplitFactory.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// SplitFactory implementation for Localhost mode diff --git a/Split/Api/RolloutCacheConfiguration.swift b/Split/Api/RolloutCacheConfiguration.swift index de00157a5..73e539836 100644 --- a/Split/Api/RolloutCacheConfiguration.swift +++ b/Split/Api/RolloutCacheConfiguration.swift @@ -1,4 +1,5 @@ import Foundation +import Logging /// Configuration class for rollout cache. Internal use only. @objc public class RolloutCacheConfiguration: NSObject { diff --git a/Split/Api/SplitClientConfig.swift b/Split/Api/SplitClientConfig.swift index 131ef7a64..02f223866 100644 --- a/Split/Api/SplitClientConfig.swift +++ b/Split/Api/SplitClientConfig.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging public typealias SplitImpressionListener = (SplitImpression) -> Void @@ -126,11 +127,13 @@ public class SplitClientConfig: NSObject { @available(*, deprecated, message: "Use logLevel instead") @objc public var isDebugModeEnabled: Bool { get { - return Logger.shared.level == .debug + Logger.ensureInitialized() + return SplitLogLevel.from(Logger.shared.level) == .debug } set { + Logger.ensureInitialized() if Logger.shared.level == .none { - Logger.shared.level = newValue ? .debug : .none + Logger.shared.level = newValue ? SplitLogLevel.debug.toLogLevel() : .none } } } @@ -142,11 +145,13 @@ public class SplitClientConfig: NSObject { @available(*, deprecated, message: "Use logLevel instead") @objc public var isVerboseModeEnabled: Bool { get { - return Logger.shared.level == .verbose + Logger.ensureInitialized() + return SplitLogLevel.from(Logger.shared.level) == .verbose } set { + Logger.ensureInitialized() if Logger.shared.level == .none { - Logger.shared.level = newValue ? .verbose : .none + Logger.shared.level = newValue ? SplitLogLevel.verbose.toLogLevel() : .none } } } @@ -155,15 +160,18 @@ public class SplitClientConfig: NSObject { /// Swift only method public var logLevel: SplitLogLevel { get { - return Logger.shared.level + Logger.ensureInitialized() + return SplitLogLevel.from(Logger.shared.level) } set { - Logger.shared.level = newValue + Logger.ensureInitialized() + Logger.shared.level = newValue.toLogLevel() } } @objc public func set(logLevel: String) { - Logger.shared.level = SplitLogLevel(rawValue: logLevel) ?? .none + Logger.ensureInitialized() + Logger.shared.level = (SplitLogLevel(rawValue: logLevel) ?? .none).toLogLevel() } /// diff --git a/Split/Api/SplitClientManager.swift b/Split/Api/SplitClientManager.swift index db20eec6c..1f83855a4 100644 --- a/Split/Api/SplitClientManager.swift +++ b/Split/Api/SplitClientManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SplitClientManager: AnyObject { var defaultClient: SplitClient? { get } diff --git a/Split/Api/SplitDatabaseHelper.swift b/Split/Api/SplitDatabaseHelper.swift index f18324373..7e698b70a 100644 --- a/Split/Api/SplitDatabaseHelper.swift +++ b/Split/Api/SplitDatabaseHelper.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging struct SplitDatabaseHelper { static private let kDbMagicCharsCount = 4 diff --git a/Split/Api/SplitLogLevel.swift b/Split/Api/SplitLogLevel.swift index 566786f87..e0d2a20d3 100644 --- a/Split/Api/SplitLogLevel.swift +++ b/Split/Api/SplitLogLevel.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging public enum SplitLogLevel: String { @@ -33,4 +34,42 @@ public enum SplitLogLevel: String { return 5 } } + + /// Maps SplitLogLevel to Logging's LogLevel + func toLogLevel() -> LogLevel { + switch self { + case .verbose: + return .verbose + case .debug: + return .debug + case .info: + return .info + case .warning: + return .warning + case .error: + return .error + case .none: + return .none + } + } + + /// Creates SplitLogLevel from Logging's LogLevel + static func from(_ logLevel: LogLevel) -> SplitLogLevel { + switch logLevel { + case .verbose: + return .verbose + case .debug: + return .debug + case .info: + return .info + case .warning: + return .warning + case .error: + return .error + case .none: + return .none + @unknown default: + return .none + } + } } diff --git a/Split/Api/SyncConfig.swift b/Split/Api/SyncConfig.swift index 6f488310c..a4079614e 100644 --- a/Split/Api/SyncConfig.swift +++ b/Split/Api/SyncConfig.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging @objc public class SyncConfig: NSObject { private(set) var filters: [SplitFilter] diff --git a/Split/Api/UserConsentManager.swift b/Split/Api/UserConsentManager.swift index 1596cb7cb..4eeb85de1 100644 --- a/Split/Api/UserConsentManager.swift +++ b/Split/Api/UserConsentManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol UserConsentManager: AnyObject { func set(_ status: UserConsent) diff --git a/Split/Common/Extensions/Array+DynamicCodable.swift b/Split/Common/Extensions/Array+DynamicCodable.swift index ab81ebe40..77d99d6ec 100644 --- a/Split/Common/Extensions/Array+DynamicCodable.swift +++ b/Split/Common/Extensions/Array+DynamicCodable.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging extension Array: DynamicEncodable where Element: DynamicEncodable { func toJsonObject() -> Any { diff --git a/Split/Common/Extensions/Dictionary+DynamicCodable.swift b/Split/Common/Extensions/Dictionary+DynamicCodable.swift index fb46b8339..ca1c7a785 100644 --- a/Split/Common/Extensions/Dictionary+DynamicCodable.swift +++ b/Split/Common/Extensions/Dictionary+DynamicCodable.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging extension Dictionary: DynamicEncodable where Key: Hashable, Value: DynamicEncodable { func toJsonObject() -> Any { diff --git a/Split/Common/Extensions/String+Utils.swift b/Split/Common/Extensions/String+Utils.swift index 280011958..d78f5517e 100644 --- a/Split/Common/Extensions/String+Utils.swift +++ b/Split/Common/Extensions/String+Utils.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging extension Substring { func asString() -> String { diff --git a/Split/Common/Utils/Cipher.swift b/Split/Common/Utils/Cipher.swift index 78511df74..a4538598c 100644 --- a/Split/Common/Utils/Cipher.swift +++ b/Split/Common/Utils/Cipher.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CommonCrypto protocol KeyGenerator { diff --git a/Split/Common/Utils/CompressionUtil.swift b/Split/Common/Utils/CompressionUtil.swift index 42de5c394..5410e7ff4 100644 --- a/Split/Common/Utils/CompressionUtil.swift +++ b/Split/Common/Utils/CompressionUtil.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import Compression enum CompressionType: Decodable { diff --git a/Split/Common/Utils/DbCipher.swift b/Split/Common/Utils/DbCipher.swift index afdd92be4..de9877c63 100644 --- a/Split/Common/Utils/DbCipher.swift +++ b/Split/Common/Utils/DbCipher.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData struct DbCipher { diff --git a/Split/Common/Utils/DbEncryptionManager.swift b/Split/Common/Utils/DbEncryptionManager.swift index 52ede2b21..40fa45b10 100644 --- a/Split/Common/Utils/DbEncryptionManager.swift +++ b/Split/Common/Utils/DbEncryptionManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging struct DbEncryptionManager { diff --git a/Split/Common/Utils/FileUtil.swift b/Split/Common/Utils/FileUtil.swift index 3ac40937d..44e263808 100644 --- a/Split/Common/Utils/FileUtil.swift +++ b/Split/Common/Utils/FileUtil.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging // FileHelper struct FileUtil { diff --git a/Split/Common/Utils/InfoUtils.swift b/Split/Common/Utils/InfoUtils.swift index 53e97c35f..d63fd1b36 100644 --- a/Split/Common/Utils/InfoUtils.swift +++ b/Split/Common/Utils/InfoUtils.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class InfoUtils { diff --git a/Split/Common/Utils/NotificationsHelper.swift b/Split/Common/Utils/NotificationsHelper.swift index b7b51a01f..e5a88811c 100644 --- a/Split/Common/Utils/NotificationsHelper.swift +++ b/Split/Common/Utils/NotificationsHelper.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging #if canImport(UIKit) import UIKit diff --git a/Split/Common/Utils/ThreadUtils.swift b/Split/Common/Utils/ThreadUtils.swift index 01ce9a2f2..1ed530c8b 100644 --- a/Split/Common/Utils/ThreadUtils.swift +++ b/Split/Common/Utils/ThreadUtils.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class ThreadUtils { static func delay(seconds: Double) { diff --git a/Split/Common/Validators/PropertyValidator.swift b/Split/Common/Validators/PropertyValidator.swift index d731f259f..77acda8a2 100644 --- a/Split/Common/Validators/PropertyValidator.swift +++ b/Split/Common/Validators/PropertyValidator.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol PropertyValidator { /// Validates properties for events and impressions diff --git a/Split/Common/Validators/ValidatorMessageLogger.swift b/Split/Common/Validators/ValidatorMessageLogger.swift index 78e89f778..fc7eddbc0 100644 --- a/Split/Common/Validators/ValidatorMessageLogger.swift +++ b/Split/Common/Validators/ValidatorMessageLogger.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Tags to use when logging message on validation diff --git a/Split/Engine/DefaultTreatmentManager.swift b/Split/Engine/DefaultTreatmentManager.swift index 0d80d1192..f364e6820 100644 --- a/Split/Engine/DefaultTreatmentManager.swift +++ b/Split/Engine/DefaultTreatmentManager.swift @@ -6,6 +6,7 @@ // Copyright © 2019 Split. All rights reserved. import Foundation +import Logging class DefaultTreatmentManager: TreatmentManager, @unchecked Sendable { diff --git a/Split/Engine/Evaluator.swift b/Split/Engine/Evaluator.swift index 826d4534c..233cc6790 100644 --- a/Split/Engine/Evaluator.swift +++ b/Split/Engine/Evaluator.swift @@ -1,6 +1,7 @@ // Created by Natalia Stele on 11/14/17 import Foundation +import Logging // swiftlint:disable function_body_length protocol Evaluator { diff --git a/Split/Engine/FallbackTreatments/FallbackSanitizer.swift b/Split/Engine/FallbackTreatments/FallbackSanitizer.swift index 93117b4ff..922a10ce6 100644 --- a/Split/Engine/FallbackTreatments/FallbackSanitizer.swift +++ b/Split/Engine/FallbackTreatments/FallbackSanitizer.swift @@ -1,6 +1,7 @@ // Created by Martin Cardozo on 26/08/2025 import Foundation +import Logging final class FallbackSanitizer: NSObject { diff --git a/Split/Engine/FallbackTreatments/FallbackTreatments.swift b/Split/Engine/FallbackTreatments/FallbackTreatments.swift index c6faafb0b..4390bfbbc 100644 --- a/Split/Engine/FallbackTreatments/FallbackTreatments.swift +++ b/Split/Engine/FallbackTreatments/FallbackTreatments.swift @@ -1,6 +1,7 @@ // Created by Martin Cardozo on 25/08/2025 import Foundation +import Logging /// A class that represents a fallback treatment configuration for feature flags. /// diff --git a/Split/Engine/Hashing/Murmur64x128.swift b/Split/Engine/Hashing/Murmur64x128.swift index 2ac23a21a..152f20068 100644 --- a/Split/Engine/Hashing/Murmur64x128.swift +++ b/Split/Engine/Hashing/Murmur64x128.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class Murmur64x128 { /// diff --git a/Split/Events/SplitEventActionTask.swift b/Split/Events/SplitEventActionTask.swift index f434246fb..2b6279a57 100644 --- a/Split/Events/SplitEventActionTask.swift +++ b/Split/Events/SplitEventActionTask.swift @@ -1,6 +1,7 @@ // Created by Javier L. Avrudsky on 7/6/18 import Foundation +import Logging internal typealias SplitActionWithMetadata = @Sendable (T) -> () diff --git a/Split/Events/SplitEventsManager.swift b/Split/Events/SplitEventsManager.swift index 3b5fb5e4e..c35c69e63 100644 --- a/Split/Events/SplitEventsManager.swift +++ b/Split/Events/SplitEventsManager.swift @@ -7,6 +7,7 @@ // Update: Replacing timer by blocking queue. 05-10-2021 // import Foundation +import Logging protocol SplitEventsManager: AnyObject, Sendable { func register(event: SplitEvent, task: SplitEventTask) diff --git a/Split/FetcherEngine/HttpMySegmentsFetcher.swift b/Split/FetcherEngine/HttpMySegmentsFetcher.swift index 5a410a6f7..c944fd0ea 100644 --- a/Split/FetcherEngine/HttpMySegmentsFetcher.swift +++ b/Split/FetcherEngine/HttpMySegmentsFetcher.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol HttpMySegmentsFetcher { func execute(userKey: String, till: Int64?, headers: [String: String]?) throws -> AllSegmentsChange? diff --git a/Split/FetcherEngine/HttpSplitFetcher.swift b/Split/FetcherEngine/HttpSplitFetcher.swift index 2a1a34dde..abf44f358 100644 --- a/Split/FetcherEngine/HttpSplitFetcher.swift +++ b/Split/FetcherEngine/HttpSplitFetcher.swift @@ -5,6 +5,7 @@ // Created by Javier Avrudsky on 02-Dic-2020 import Foundation +import Logging protocol HttpSplitFetcher { func execute(since: Int64, rbSince: Int64?, till: Int64?, headers: HttpHeaders?, spec: String?) throws -> TargetingRulesChange diff --git a/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift b/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift index 8233aaa00..6cfe2f401 100644 --- a/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class EventsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift b/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift index 57c4ed21a..88fb18e52 100644 --- a/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class ImpressionsCountRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift b/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift index 28b1d64bf..c38974cd7 100644 --- a/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class ImpressionsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift b/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift index 25e761141..04edb7c9e 100644 --- a/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class TelemetryConfigRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift b/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift index 26e847bfb..4528cc5a7 100644 --- a/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift +++ b/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol HttpTelemetryStatsRecorder { func isEndpointAvailable() -> Bool diff --git a/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift b/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift index e52845046..997142033 100644 --- a/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class TelemetryStatsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift b/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift index 251e3fa6d..d271c2e9a 100644 --- a/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class UniqueKeysRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift b/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift index b357b96c8..b92e4c936 100644 --- a/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol BackgroundSyncWorker { func execute() diff --git a/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift b/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift index 1bc0ffc49..82d7609f6 100644 --- a/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol PeriodicTimer { func trigger() func stop() diff --git a/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift b/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift index a0ba8ef10..d4f38eb0e 100644 --- a/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Retrieves segments changes or a user key diff --git a/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift b/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift index 531e35395..1f78ddc57 100644 --- a/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RetryableSyncWorker: Sendable { typealias SyncCompletion = (Bool) -> Void diff --git a/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift b/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift index 13eec379d..e16c79c14 100644 --- a/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift +++ b/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging #if os(iOS) || os(tvOS) @preconcurrency import BackgroundTasks diff --git a/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift b/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift index 9666d2049..0241d8e8a 100644 --- a/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift +++ b/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging struct SyncResult { let success: Bool diff --git a/Split/FetcherEngine/SyncHelper.swift b/Split/FetcherEngine/SyncHelper.swift index 95c0316d5..21570b8c5 100644 --- a/Split/FetcherEngine/SyncHelper.swift +++ b/Split/FetcherEngine/SyncHelper.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SyncHelper { func checkEndpointReachability(restClient: RestClient, resource: Resource) throws diff --git a/Split/Initialization/RolloutCacheManager.swift b/Split/Initialization/RolloutCacheManager.swift index 44f3fff5e..17d7ea64e 100644 --- a/Split/Initialization/RolloutCacheManager.swift +++ b/Split/Initialization/RolloutCacheManager.swift @@ -1,4 +1,5 @@ import Foundation +import Logging protocol RolloutCacheManager { func validateCache(listener: (() -> Void)) diff --git a/Split/Localhost/LocalhostClientManager.swift b/Split/Localhost/LocalhostClientManager.swift index 3e18faf8f..ec311fb7a 100644 --- a/Split/Localhost/LocalhostClientManager.swift +++ b/Split/Localhost/LocalhostClientManager.swift @@ -6,6 +6,7 @@ // Copyright © 2024 Split. All rights reserved. import Foundation +import Logging class LocalhostClientManager: SplitClientManager, @unchecked Sendable { diff --git a/Split/Localhost/LocalhostFileDataSource.swift b/Split/Localhost/LocalhostFileDataSource.swift index f5017b22d..afca03a27 100644 --- a/Split/Localhost/LocalhostFileDataSource.swift +++ b/Split/Localhost/LocalhostFileDataSource.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol LocalhostDataSource: AnyObject { typealias IncomingDataHandler = ([String: Split]?) -> Void diff --git a/Split/Localhost/LocalhostSplitsParser.swift b/Split/Localhost/LocalhostSplitsParser.swift index b9e5f09a1..2ec7e8de0 100644 --- a/Split/Localhost/LocalhostSplitsParser.swift +++ b/Split/Localhost/LocalhostSplitsParser.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /** Data structure to hold parsed feature flags and its corresponding treatment */ diff --git a/Split/Localhost/LocalhostSynchronizer.swift b/Split/Localhost/LocalhostSynchronizer.swift index 819879cad..4fe7b3a11 100644 --- a/Split/Localhost/LocalhostSynchronizer.swift +++ b/Split/Localhost/LocalhostSynchronizer.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class LocalhostSynchronizer: FeatureFlagsSynchronizer, @unchecked Sendable { diff --git a/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift b/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift index a9711496e..729093449 100644 --- a/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift +++ b/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class SpaceDelimitedLocalhostSplitsParser: LocalhostSplitsParser { diff --git a/Split/Localhost/YamlLocalhostSplitsParser.swift b/Split/Localhost/YamlLocalhostSplitsParser.swift index 58ec33256..21f4a5285 100644 --- a/Split/Localhost/YamlLocalhostSplitsParser.swift +++ b/Split/Localhost/YamlLocalhostSplitsParser.swift @@ -6,6 +6,7 @@ // Copyright © 2019 Split. All rights reserved. import Foundation +import Logging class YamlLocalhostSplitsParser: LocalhostSplitsParser { diff --git a/Split/Matchers/InRuleBasedSegmentMatcher.swift b/Split/Matchers/InRuleBasedSegmentMatcher.swift index 1560c1880..44779386a 100644 --- a/Split/Matchers/InRuleBasedSegmentMatcher.swift +++ b/Split/Matchers/InRuleBasedSegmentMatcher.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class InRuleBasedSegmentMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/PrerequisitesMatcher.swift b/Split/Matchers/PrerequisitesMatcher.swift index 7a5470df0..88e361b37 100644 --- a/Split/Matchers/PrerequisitesMatcher.swift +++ b/Split/Matchers/PrerequisitesMatcher.swift @@ -2,6 +2,7 @@ // Copyright © 2025 Split. All rights reserved. import Foundation +import Logging class PrerequisitesMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/BetweenSemverMatcher.swift b/Split/Matchers/Semver/BetweenSemverMatcher.swift index f4d5efc08..3449947a0 100644 --- a/Split/Matchers/Semver/BetweenSemverMatcher.swift +++ b/Split/Matchers/Semver/BetweenSemverMatcher.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class BetweenSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/EqualToSemverMatcher.swift b/Split/Matchers/Semver/EqualToSemverMatcher.swift index efc23a9d7..df54f40de 100644 --- a/Split/Matchers/Semver/EqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/EqualToSemverMatcher.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class EqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift b/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift index f92a44ee6..65f75269a 100644 --- a/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class GreaterThanOrEqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift b/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift index f4ebf781b..50985120a 100644 --- a/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class LessThanOrEqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/Semver.swift b/Split/Matchers/Semver/Semver.swift index ee5c3b827..ba7c0ea0b 100644 --- a/Split/Matchers/Semver/Semver.swift +++ b/Split/Matchers/Semver/Semver.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging enum SemverParseError: Error { case invalidVersionFormat(String) diff --git a/Split/Network/HttpClient/HttpClient.swift b/Split/Network/HttpClient/HttpClient.swift index cc42d6625..cd3c53500 100644 --- a/Split/Network/HttpClient/HttpClient.swift +++ b/Split/Network/HttpClient/HttpClient.swift @@ -5,6 +5,7 @@ // Created by Javier L. Avrudsky on 5/23/18. import Foundation +import Logging // MARK: HttpSession diff --git a/Split/Network/HttpClient/HttpRequest.swift b/Split/Network/HttpClient/HttpRequest.swift index 6cae96063..83b59e02e 100644 --- a/Split/Network/HttpClient/HttpRequest.swift +++ b/Split/Network/HttpClient/HttpRequest.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging protocol HttpRequest: Sendable { typealias RequestCompletionHandler = (HttpResponse) -> Void diff --git a/Split/Network/HttpClient/HttpRequestManager.swift b/Split/Network/HttpClient/HttpRequestManager.swift index f5f59f1a3..8a7a038a6 100644 --- a/Split/Network/HttpClient/HttpRequestManager.swift +++ b/Split/Network/HttpClient/HttpRequestManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Stores sent requests in a list diff --git a/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift b/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift index 2fadcce0d..5ad8d93af 100644 --- a/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift +++ b/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// Handles proxy spec fallback and recovery. /// diff --git a/Split/Network/RestClient/RestClient+Impressions.swift b/Split/Network/RestClient/RestClient+Impressions.swift index aaa38213d..5493453f4 100644 --- a/Split/Network/RestClient/RestClient+Impressions.swift +++ b/Split/Network/RestClient/RestClient+Impressions.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientImpressions: RestClient { func sendImpressions(impressions: [ImpressionsTest], completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+ImpressionsCount.swift b/Split/Network/RestClient/RestClient+ImpressionsCount.swift index bddd164f8..fa5021e1c 100644 --- a/Split/Network/RestClient/RestClient+ImpressionsCount.swift +++ b/Split/Network/RestClient/RestClient+ImpressionsCount.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientImpressionsCount: RestClient { func send(counts: ImpressionsCount, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TelemetryConfig.swift b/Split/Network/RestClient/RestClient+TelemetryConfig.swift index c2bd19f11..05fdd35a4 100644 --- a/Split/Network/RestClient/RestClient+TelemetryConfig.swift +++ b/Split/Network/RestClient/RestClient+TelemetryConfig.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientTelemetryConfig: RestClient { func send(config: TelemetryConfig, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TelemetryStats.swift b/Split/Network/RestClient/RestClient+TelemetryStats.swift index cff1a8f2d..1dd7229ce 100644 --- a/Split/Network/RestClient/RestClient+TelemetryStats.swift +++ b/Split/Network/RestClient/RestClient+TelemetryStats.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientTelemetryStats: RestClient { func send(stats: TelemetryStats, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TrackEvents.swift b/Split/Network/RestClient/RestClient+TrackEvents.swift index 5d032e311..3a6fd783a 100644 --- a/Split/Network/RestClient/RestClient+TrackEvents.swift +++ b/Split/Network/RestClient/RestClient+TrackEvents.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientTrackEvents: RestClient { func sendTrackEvents(events: [EventDTO], completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+UniqueKeys.swift b/Split/Network/RestClient/RestClient+UniqueKeys.swift index 0f2864604..39f6a588b 100644 --- a/Split/Network/RestClient/RestClient+UniqueKeys.swift +++ b/Split/Network/RestClient/RestClient+UniqueKeys.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClientUniqueKeys: RestClient { func send(uniqueKeys: UniqueKeys, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient.swift b/Split/Network/RestClient/RestClient.swift index 694a273ef..cecf85de8 100644 --- a/Split/Network/RestClient/RestClient.swift +++ b/Split/Network/RestClient/RestClient.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RestClient { func isServerAvailable(_ url: URL) -> Bool diff --git a/Split/Network/Security/TlsPinChecker.swift b/Split/Network/Security/TlsPinChecker.swift index 50fbb9a8a..f04a998b3 100644 --- a/Split/Network/Security/TlsPinChecker.swift +++ b/Split/Network/Security/TlsPinChecker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CommonCrypto enum PinType { diff --git a/Split/Network/Streaming/BackoffCounterTimer.swift b/Split/Network/Streaming/BackoffCounterTimer.swift index b9e52d15a..1d4404408 100644 --- a/Split/Network/Streaming/BackoffCounterTimer.swift +++ b/Split/Network/Streaming/BackoffCounterTimer.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol BackoffCounterTimer { func schedule(handler: @escaping @Sendable () -> Void) diff --git a/Split/Network/Streaming/DefaultSseNotificationParser.swift b/Split/Network/Streaming/DefaultSseNotificationParser.swift index c5c0bea39..1ac7e8d44 100644 --- a/Split/Network/Streaming/DefaultSseNotificationParser.swift +++ b/Split/Network/Streaming/DefaultSseNotificationParser.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SseNotificationParser { diff --git a/Split/Network/Streaming/JwtTokenParser.swift b/Split/Network/Streaming/JwtTokenParser.swift index e43cb347a..4797445a1 100644 --- a/Split/Network/Streaming/JwtTokenParser.swift +++ b/Split/Network/Streaming/JwtTokenParser.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging enum JwtTokenError: Error { case tokenIsNull diff --git a/Split/Network/Streaming/NotificationManagerKeeper.swift b/Split/Network/Streaming/NotificationManagerKeeper.swift index 25a78b7a3..4912ee764 100644 --- a/Split/Network/Streaming/NotificationManagerKeeper.swift +++ b/Split/Network/Streaming/NotificationManagerKeeper.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol NotificationManagerKeeper { var isStreamingActive: Bool { get } diff --git a/Split/Network/Streaming/PushNotificationManager.swift b/Split/Network/Streaming/PushNotificationManager.swift index e47a923ce..7ee398be2 100644 --- a/Split/Network/Streaming/PushNotificationManager.swift +++ b/Split/Network/Streaming/PushNotificationManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol PushNotificationManager { // Visible for testing. Make possible to inject stub diff --git a/Split/Network/Streaming/SseClient.swift b/Split/Network/Streaming/SseClient.swift index 878afae9c..fe0ccc0fb 100644 --- a/Split/Network/Streaming/SseClient.swift +++ b/Split/Network/Streaming/SseClient.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging struct SseClientConstants { static let pushNotificationChannelsParam = "channels" diff --git a/Split/Network/Streaming/SseConnectionHandler.swift b/Split/Network/Streaming/SseConnectionHandler.swift index 0349ae69f..9f4f5a202 100644 --- a/Split/Network/Streaming/SseConnectionHandler.swift +++ b/Split/Network/Streaming/SseConnectionHandler.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class SseConnectionHandler: @unchecked Sendable { private let clientLock = NSLock() diff --git a/Split/Network/Streaming/SseHandler.swift b/Split/Network/Streaming/SseHandler.swift index 38edf718e..186fc4346 100644 --- a/Split/Network/Streaming/SseHandler.swift +++ b/Split/Network/Streaming/SseHandler.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SseHandler { func isConnectionConfirmed(message: [String: String]) -> Bool diff --git a/Split/Network/Streaming/SseNotificationProcessor.swift b/Split/Network/Streaming/SseNotificationProcessor.swift index 35cccbd10..e8943f1ff 100644 --- a/Split/Network/Streaming/SseNotificationProcessor.swift +++ b/Split/Network/Streaming/SseNotificationProcessor.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SseNotificationProcessor { func process(_ notification: IncomingNotification) diff --git a/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift b/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift index 7344ea532..fb920a4f2 100644 --- a/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift +++ b/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging class SegmentsUpdateWorker: UpdateWorker, @unchecked Sendable { diff --git a/Split/Network/Streaming/SyncUpdateWorker.swift b/Split/Network/Streaming/SyncUpdateWorker.swift index 1192e61d4..e6763cd3d 100644 --- a/Split/Network/Streaming/SyncUpdateWorker.swift +++ b/Split/Network/Streaming/SyncUpdateWorker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging /// /// Swift doesn't allow dynamic dispatch diff --git a/Split/Network/Sync/FeatureFlagsSynchronizer.swift b/Split/Network/Sync/FeatureFlagsSynchronizer.swift index f23d59c67..2410cf93d 100644 --- a/Split/Network/Sync/FeatureFlagsSynchronizer.swift +++ b/Split/Network/Sync/FeatureFlagsSynchronizer.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol FeatureFlagsSynchronizer { func load() diff --git a/Split/Network/Sync/ImpressionsTracker.swift b/Split/Network/Sync/ImpressionsTracker.swift index 4f884a99d..23de81af1 100644 --- a/Split/Network/Sync/ImpressionsTracker.swift +++ b/Split/Network/Sync/ImpressionsTracker.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging enum RecordingService { case uniqueKeys diff --git a/Split/Network/Sync/SyncManager.swift b/Split/Network/Sync/SyncManager.swift index 8cdf4a3d0..cc4c146a5 100644 --- a/Split/Network/Sync/SyncManager.swift +++ b/Split/Network/Sync/SyncManager.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SyncManager { func start() diff --git a/Split/Secure/SecureDataStore.swift b/Split/Secure/SecureDataStore.swift index 4bd8c8e38..bd7bf1384 100644 --- a/Split/Secure/SecureDataStore.swift +++ b/Split/Secure/SecureDataStore.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class SecureDataStore: @unchecked Sendable { diff --git a/Split/Storage/Attributes/AttributesDao.swift b/Split/Storage/Attributes/AttributesDao.swift index 64f41b12a..817985e8c 100644 --- a/Split/Storage/Attributes/AttributesDao.swift +++ b/Split/Storage/Attributes/AttributesDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol AttributesDao { diff --git a/Split/Storage/CoreDataContextBuilder.swift b/Split/Storage/CoreDataContextBuilder.swift index 02f4c9dfd..c86978a9b 100644 --- a/Split/Storage/CoreDataContextBuilder.swift +++ b/Split/Storage/CoreDataContextBuilder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData class CoreDataHelperBuilder { diff --git a/Split/Storage/CoreDataHelper.swift b/Split/Storage/CoreDataHelper.swift index c7c3baf7d..de502de0c 100644 --- a/Split/Storage/CoreDataHelper.swift +++ b/Split/Storage/CoreDataHelper.swift @@ -6,6 +6,7 @@ // Copyright © 2020 Split. All rights reserved. // import CoreData +import Logging enum CoreDataEntity: String { case event = "Event" diff --git a/Split/Storage/DefaultFileStorage.swift b/Split/Storage/DefaultFileStorage.swift index fc5fc5ff1..731d323ea 100644 --- a/Split/Storage/DefaultFileStorage.swift +++ b/Split/Storage/DefaultFileStorage.swift @@ -6,6 +6,7 @@ // import Foundation +import Logging class DefaultFileStorage: FileStorage, @unchecked Sendable { diff --git a/Split/Storage/Events/EventDao.swift b/Split/Storage/Events/EventDao.swift index 49a3a8080..70a4f78d9 100644 --- a/Split/Storage/Events/EventDao.swift +++ b/Split/Storage/Events/EventDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol EventDao { diff --git a/Split/Storage/Events/EventsStorage.swift b/Split/Storage/Events/EventsStorage.swift index 86c35bb21..9174dedbe 100644 --- a/Split/Storage/Events/EventsStorage.swift +++ b/Split/Storage/Events/EventsStorage.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol EventsStorage { func enablePersistence(_ enable: Bool) diff --git a/Split/Storage/Global/GlobalSecureStorage.swift b/Split/Storage/Global/GlobalSecureStorage.swift index 407997ee1..585933564 100644 --- a/Split/Storage/Global/GlobalSecureStorage.swift +++ b/Split/Storage/Global/GlobalSecureStorage.swift @@ -6,6 +6,7 @@ // Copyright © 2021 Split. All rights reserved. // import Foundation +import Logging class GlobalSecureStorage: KeyValueStorage, @unchecked Sendable { diff --git a/Split/Storage/HashedImpression/HashedImpressionStorage.swift b/Split/Storage/HashedImpression/HashedImpressionStorage.swift index 04e92811c..879edc9ac 100644 --- a/Split/Storage/HashedImpression/HashedImpressionStorage.swift +++ b/Split/Storage/HashedImpression/HashedImpressionStorage.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol HashedImpressionsStorage { func loadFromDb() diff --git a/Split/Storage/Impressions/ImpressionDao.swift b/Split/Storage/Impressions/ImpressionDao.swift index d4b955e71..514d59c2d 100644 --- a/Split/Storage/Impressions/ImpressionDao.swift +++ b/Split/Storage/Impressions/ImpressionDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol ImpressionDao { diff --git a/Split/Storage/Impressions/ImpressionsCountDao.swift b/Split/Storage/Impressions/ImpressionsCountDao.swift index b983b2643..e5fdb2243 100644 --- a/Split/Storage/Impressions/ImpressionsCountDao.swift +++ b/Split/Storage/Impressions/ImpressionsCountDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol ImpressionsCountDao { diff --git a/Split/Storage/Impressions/ImpressionsMode.swift b/Split/Storage/Impressions/ImpressionsMode.swift index 49ccc4200..36fdb82e8 100644 --- a/Split/Storage/Impressions/ImpressionsMode.swift +++ b/Split/Storage/Impressions/ImpressionsMode.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging public enum ImpressionsMode: String { case optimized = "OPTIMIZED" diff --git a/Split/Storage/Impressions/ImpressionsStorage.swift b/Split/Storage/Impressions/ImpressionsStorage.swift index d4b806aa6..5c9db7773 100644 --- a/Split/Storage/Impressions/ImpressionsStorage.swift +++ b/Split/Storage/Impressions/ImpressionsStorage.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol ImpressionsStorage { func enablePersistence(_ enable: Bool) diff --git a/Split/Storage/MySegments/MySegmentsDao.swift b/Split/Storage/MySegments/MySegmentsDao.swift index 93ccf0d57..3ec66f16c 100644 --- a/Split/Storage/MySegments/MySegmentsDao.swift +++ b/Split/Storage/MySegments/MySegmentsDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol MySegmentsDao { diff --git a/Split/Storage/PersistenceBreaker.swift b/Split/Storage/PersistenceBreaker.swift index dd58042b5..91f6c006b 100644 --- a/Split/Storage/PersistenceBreaker.swift +++ b/Split/Storage/PersistenceBreaker.swift @@ -5,6 +5,7 @@ // import Foundation +import Logging /// Protocol for controlling persistence behavior in response to failures. /// diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift index 1de16b9b4..6553d0c5b 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol RuleBasedSegmentDao { diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift index 9c9cf0d7a..fb70c5263 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RuleBasedSegmentsDecoder { func decode(_ jsonSegments: [String]) -> [RuleBasedSegment] diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift index 104a05a1e..c515dd11c 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol RuleBasedSegmentsEncoder { func encode(_ segments: [RuleBasedSegment]) -> [String: String] diff --git a/Split/Storage/Splits/PersistentSplitsStorage.swift b/Split/Storage/Splits/PersistentSplitsStorage.swift index 25bb23259..6b355f0ce 100644 --- a/Split/Storage/Splits/PersistentSplitsStorage.swift +++ b/Split/Storage/Splits/PersistentSplitsStorage.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol PersistentSplitsStorage { func update(splitChange: ProcessedSplitChange, onFailure: ((Error) -> Void)?) diff --git a/Split/Storage/Splits/SplitDao.swift b/Split/Storage/Splits/SplitDao.swift index fc9d610c0..2ce5235f9 100644 --- a/Split/Storage/Splits/SplitDao.swift +++ b/Split/Storage/Splits/SplitDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol SplitDao { diff --git a/Split/Storage/Splits/SplitsDecoder.swift b/Split/Storage/Splits/SplitsDecoder.swift index ad026392c..e53646457 100644 --- a/Split/Storage/Splits/SplitsDecoder.swift +++ b/Split/Storage/Splits/SplitsDecoder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SplitsDecoder { func decode(_ list: [String]) -> [Split] diff --git a/Split/Storage/Splits/SplitsEncoder.swift b/Split/Storage/Splits/SplitsEncoder.swift index 48b48402c..4eaae2944 100644 --- a/Split/Storage/Splits/SplitsEncoder.swift +++ b/Split/Storage/Splits/SplitsEncoder.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SplitsEncoder { func encode(_ list: [Split]) -> [String: String] diff --git a/Split/Storage/Splits/SplitsStorage.swift b/Split/Storage/Splits/SplitsStorage.swift index 49ef8b56b..c284c15d2 100644 --- a/Split/Storage/Splits/SplitsStorage.swift +++ b/Split/Storage/Splits/SplitsStorage.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging protocol SyncSplitsStorage: RolloutDefinitionsCache { func update(splitChange: ProcessedSplitChange) -> Bool diff --git a/Split/Storage/UniqueKeys/UniqueKeyDao.swift b/Split/Storage/UniqueKeys/UniqueKeyDao.swift index b0d9c42ee..0ca62d830 100644 --- a/Split/Storage/UniqueKeys/UniqueKeyDao.swift +++ b/Split/Storage/UniqueKeys/UniqueKeyDao.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging import CoreData protocol UniqueKeyDao { diff --git a/Split/_KwiftDependencies.swift b/Split/_KwiftDependencies.swift index 4803cf161..020d7bc2e 100644 --- a/Split/_KwiftDependencies.swift +++ b/Split/_KwiftDependencies.swift @@ -1,6 +1,9 @@ +import Logging + /// Auto-generated by Kwift to verify dependency wiring at compile time. private enum _KwiftDependencies { static func link() { - _ = LoggingInternal() + // Ensure Logging module is linked + _ = Logger.shared } } \ No newline at end of file diff --git a/SplitTests/Fake/LogPrinterStub.swift b/SplitTests/Fake/LogPrinterStub.swift index f3b3d285e..3a170d7ef 100644 --- a/SplitTests/Fake/LogPrinterStub.swift +++ b/SplitTests/Fake/LogPrinterStub.swift @@ -7,6 +7,7 @@ // import Foundation +import Logging @testable import Split class LogPrinterStub: LogPrinter, @unchecked Sendable { diff --git a/SplitTests/Integration/Api/LoggerTest.swift b/SplitTests/Integration/Api/LoggerTest.swift index fdb440cb5..1a4366234 100644 --- a/SplitTests/Integration/Api/LoggerTest.swift +++ b/SplitTests/Integration/Api/LoggerTest.swift @@ -7,11 +7,12 @@ // import Foundation +import Logging @testable import Split import XCTest -@testable import Split +// This test verifies that SplitLogLevel mapping to LogLevel works correctly class LoggerTest : XCTestCase { let printer = LogPrinterStub() @@ -19,10 +20,11 @@ class LoggerTest : XCTestCase { override func setUp() { printer.clear() Logger.shared.printer = printer + Logger.shared.dateProvider = SplitDateProvider() } func testNone() { - Logger.shared.level = .none + Logger.shared.level = SplitLogLevel.none.toLogLevel() logAll() @@ -34,7 +36,7 @@ class LoggerTest : XCTestCase { } func testVerbose() { - Logger.shared.level = .verbose + Logger.shared.level = SplitLogLevel.verbose.toLogLevel() logAll() @@ -46,7 +48,7 @@ class LoggerTest : XCTestCase { } func testDebug() { - Logger.shared.level = .debug + Logger.shared.level = SplitLogLevel.debug.toLogLevel() logAll() @@ -58,7 +60,7 @@ class LoggerTest : XCTestCase { } func testInfo() { - Logger.shared.level = .info + Logger.shared.level = SplitLogLevel.info.toLogLevel() logAll() @@ -70,7 +72,7 @@ class LoggerTest : XCTestCase { } func testWarning() { - Logger.shared.level = .warning + Logger.shared.level = SplitLogLevel.warning.toLogLevel() logAll() @@ -82,7 +84,7 @@ class LoggerTest : XCTestCase { } func testError() { - Logger.shared.level = .error + Logger.shared.level = SplitLogLevel.error.toLogLevel() logAll() @@ -93,7 +95,7 @@ class LoggerTest : XCTestCase { XCTAssertTrue(isLogged(level: .error)) } - private func isLogged(level: SplitLogLevel) -> Bool { + private func isLogged(level: LogLevel) -> Bool { return printer.logs.filter { $0.contains("\(level.rawValue)") }.count > 0 } @@ -107,6 +109,7 @@ class LoggerTest : XCTestCase { override func tearDown() { Logger.shared.printer = DefaultLogPrinter() + Logger.shared.dateProvider = SplitDateProvider() printer.clear() } } From e962e3e9a457f289fbdf48a3ec22f40ace81aeac Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 22:40:14 -0300 Subject: [PATCH 04/18] Update README --- Sources/Logging/README.md | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/Sources/Logging/README.md b/Sources/Logging/README.md index b921bbe50..6dca7ad7a 100644 --- a/Sources/Logging/README.md +++ b/Sources/Logging/README.md @@ -1 +1,95 @@ # Logging + +## What this module provides + +- `Logger`: shared logger with convenience methods `Logger.v/d/i/w/e` +- `LogLevel`: logging level enum +- `LogPrinter`: output interface (default prints to stdout) +- `TimeChecker`: helper to measure and log time intervals +- `DateProvider`: host-provided timestamp + label formatting (keeps this module independent from your app’s time utilities) + +## Usage + +### 1) Add as a Swift Package dependency + +In your `Package.swift`: + +```swift +.target( + name: "YourTarget", + dependencies: ["Logging"] +) +``` + +### 2) Configure required dependencies + +This module intentionally does **not** implement “real time” by default. You must provide a `DateProvider` from the host app/module (e.g. using `Foundation.Date`, your own time utils, etc). + +Example: + +```swift +import Logging +import Foundation + +struct AppDateProvider: DateProvider { + func nowMillis() -> Int64 { Int64(Date().timeIntervalSince1970 * 1000) } + func nowLabel() -> String { + let formatter = DateFormatter() + formatter.dateFormat = "dd-MM-yyyy HH:mm:ss.SSS" + return formatter.string(from: Date()) + } +} + +Logger.shared.dateProvider = AppDateProvider() +Logger.shared.level = .info +``` + +### 3) Log + +```swift +import Logging + +Logger.i("SDK initialized") +Logger.w("Something looks off", ["context": "value"]) +Logger.e("Something failed") +``` + +### Optional: customize output + +```swift +import Logging + +final class MyPrinter: LogPrinter { + func stdout(_ items: Any...) { + // route to OSLog, a file, your analytics, etc. + } +} + +Logger.shared.printer = MyPrinter() +``` + +### Optional: TimeChecker + +`TimeChecker` uses `Logger.shared.dateProvider` by default. + +```swift +import Logging + +TimeChecker.start() +// ... do work ... +TimeChecker.logInterval("Finished work") +``` + +## Notes + +- If the consumer has its own log levels, do the mapping in the consumer module (e.g. map `YourLogLevel` → `LogLevel`). + +## Running tests + +### Swift Package Manager + +From the repository root: + +```bash +swift test --filter LoggingTests +``` \ No newline at end of file From c14ee5279b95b2cf3b1d497766ea59a137f6cfbe Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 22:51:20 -0300 Subject: [PATCH 05/18] Remove unnecessary imports --- Split/Api/CertificatePinningConfig.swift | 1 - Split/Api/DefaultSplitClient.swift | 2 -- Split/Api/DefaultSplitFactory.swift | 1 - Split/Api/DefaultSplitFactoryBuilder.swift | 1 - Split/Api/DefaultSplitManager.swift | 1 - Split/Api/EventsTracker.swift | 1 - Split/Api/FilterBuilder.swift | 1 - Split/Api/FlagSetsValidator.swift | 1 - Split/Api/LocalhostSplitFactory.swift | 1 - Split/Api/RolloutCacheConfiguration.swift | 1 - Split/Api/SplitClientConfig.swift | 1 - Split/Api/SplitClientManager.swift | 1 - Split/Api/SplitDatabaseHelper.swift | 1 - Split/Api/SyncConfig.swift | 1 - Split/Api/UserConsentManager.swift | 1 - Split/Common/Extensions/Array+DynamicCodable.swift | 1 - Split/Common/Extensions/Dictionary+DynamicCodable.swift | 1 - Split/Common/Extensions/String+Utils.swift | 1 - Split/Common/Utils/Cipher.swift | 1 - Split/Common/Utils/CompressionUtil.swift | 1 - Split/Common/Utils/DbCipher.swift | 1 - Split/Common/Utils/DbEncryptionManager.swift | 1 - Split/Common/Utils/FileUtil.swift | 1 - Split/Common/Utils/InfoUtils.swift | 1 - Split/Common/Utils/NotificationsHelper.swift | 1 - Split/Common/Utils/ThreadUtils.swift | 1 - Split/Common/Validators/PropertyValidator.swift | 1 - Split/Common/Validators/ValidatorMessageLogger.swift | 1 - Split/Engine/DefaultTreatmentManager.swift | 1 - Split/Engine/Evaluator.swift | 1 - Split/Engine/FallbackTreatments/FallbackSanitizer.swift | 1 - Split/Engine/FallbackTreatments/FallbackTreatments.swift | 1 - Split/Engine/Hashing/Murmur64x128.swift | 1 - Split/Events/SplitEventActionTask.swift | 1 - Split/Events/SplitEventsManager.swift | 1 - Split/FetcherEngine/HttpMySegmentsFetcher.swift | 1 - Split/FetcherEngine/HttpSplitFetcher.swift | 1 - Split/FetcherEngine/Recorder/EventsRecorderWorker.swift | 1 - .../FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift | 1 - Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift | 1 - .../FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift | 1 - Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift | 1 - Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift | 1 - Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift | 1 - Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift | 1 - Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift | 1 - Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift | 1 - Split/FetcherEngine/Refresh/RetryableSyncWorker.swift | 1 - Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift | 1 - Split/FetcherEngine/Refresh/SplitsSyncHelper.swift | 1 - Split/FetcherEngine/SyncHelper.swift | 1 - Split/Initialization/RolloutCacheManager.swift | 1 - Split/Localhost/LocalhostClientManager.swift | 1 - Split/Localhost/LocalhostFileDataSource.swift | 1 - Split/Localhost/LocalhostSplitsParser.swift | 1 - Split/Localhost/LocalhostSynchronizer.swift | 1 - Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift | 1 - Split/Localhost/YamlLocalhostSplitsParser.swift | 1 - Split/Matchers/InRuleBasedSegmentMatcher.swift | 1 - Split/Matchers/PrerequisitesMatcher.swift | 1 - Split/Matchers/Semver/BetweenSemverMatcher.swift | 1 - Split/Matchers/Semver/EqualToSemverMatcher.swift | 1 - Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift | 1 - Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift | 1 - Split/Matchers/Semver/Semver.swift | 1 - Split/Network/HttpClient/HttpClient.swift | 1 - Split/Network/HttpClient/HttpRequest.swift | 1 - Split/Network/HttpClient/HttpRequestManager.swift | 1 - Split/Network/HttpClient/OutdatedSplitProxyHandler.swift | 1 - Split/Network/RestClient/RestClient+Impressions.swift | 1 - Split/Network/RestClient/RestClient+ImpressionsCount.swift | 1 - Split/Network/RestClient/RestClient+TelemetryConfig.swift | 1 - Split/Network/RestClient/RestClient+TelemetryStats.swift | 1 - Split/Network/RestClient/RestClient+TrackEvents.swift | 1 - Split/Network/RestClient/RestClient+UniqueKeys.swift | 1 - Split/Network/RestClient/RestClient.swift | 1 - Split/Network/Security/TlsPinChecker.swift | 1 - Split/Network/Streaming/BackoffCounterTimer.swift | 1 - Split/Network/Streaming/DefaultSseNotificationParser.swift | 1 - Split/Network/Streaming/JwtTokenParser.swift | 1 - Split/Network/Streaming/NotificationManagerKeeper.swift | 1 - Split/Network/Streaming/PushNotificationManager.swift | 1 - Split/Network/Streaming/SseClient.swift | 1 - Split/Network/Streaming/SseConnectionHandler.swift | 1 - Split/Network/Streaming/SseHandler.swift | 1 - Split/Network/Streaming/SseNotificationProcessor.swift | 1 - Split/Network/Streaming/SyncSegmentsUpdateWorker.swift | 1 - Split/Network/Streaming/SyncUpdateWorker.swift | 1 - Split/Network/Sync/FeatureFlagsSynchronizer.swift | 1 - Split/Network/Sync/ImpressionsTracker.swift | 1 - Split/Network/Sync/SyncManager.swift | 1 - Split/Secure/SecureDataStore.swift | 1 - Split/Storage/Attributes/AttributesDao.swift | 1 - Split/Storage/CoreDataContextBuilder.swift | 1 - Split/Storage/CoreDataHelper.swift | 1 - Split/Storage/DefaultFileStorage.swift | 1 - Split/Storage/Events/EventDao.swift | 1 - Split/Storage/Events/EventsStorage.swift | 1 - Split/Storage/Global/GlobalSecureStorage.swift | 1 - Split/Storage/HashedImpression/HashedImpressionStorage.swift | 1 - Split/Storage/Impressions/ImpressionDao.swift | 1 - Split/Storage/Impressions/ImpressionsCountDao.swift | 1 - Split/Storage/Impressions/ImpressionsMode.swift | 1 - Split/Storage/Impressions/ImpressionsStorage.swift | 1 - Split/Storage/MySegments/MySegmentsDao.swift | 1 - Split/Storage/PersistenceBreaker.swift | 1 - Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift | 1 - Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift | 1 - Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift | 1 - Split/Storage/Splits/PersistentSplitsStorage.swift | 1 - Split/Storage/Splits/SplitDao.swift | 1 - Split/Storage/Splits/SplitsDecoder.swift | 1 - Split/Storage/Splits/SplitsEncoder.swift | 1 - Split/Storage/Splits/SplitsStorage.swift | 1 - Split/Storage/UniqueKeys/UniqueKeyDao.swift | 1 - 115 files changed, 116 deletions(-) diff --git a/Split/Api/CertificatePinningConfig.swift b/Split/Api/CertificatePinningConfig.swift index 483e6755c..f4d7ac0d9 100644 --- a/Split/Api/CertificatePinningConfig.swift +++ b/Split/Api/CertificatePinningConfig.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging public typealias CertificatePinningFailureHandler = @Sendable(String) -> Void public typealias CertificatePinningStatusHandler = @Sendable(String, CertificatePinningStatus, String) -> Void diff --git a/Split/Api/DefaultSplitClient.swift b/Split/Api/DefaultSplitClient.swift index e4dfe1a93..0dfb46999 100644 --- a/Split/Api/DefaultSplitClient.swift +++ b/Split/Api/DefaultSplitClient.swift @@ -2,8 +2,6 @@ // Modified by Natalia Stele on 11/10/17. import Foundation -import Logging -import Logging typealias DestroyHandler = () -> Void diff --git a/Split/Api/DefaultSplitFactory.swift b/Split/Api/DefaultSplitFactory.swift index 592954093..3e36819cf 100644 --- a/Split/Api/DefaultSplitFactory.swift +++ b/Split/Api/DefaultSplitFactory.swift @@ -5,7 +5,6 @@ // Created by Brian Sztamfater on 27/9/17. import Foundation -import Logging /** Default implementation of SplitManager protocol diff --git a/Split/Api/DefaultSplitFactoryBuilder.swift b/Split/Api/DefaultSplitFactoryBuilder.swift index dad3f47b2..ec0123524 100644 --- a/Split/Api/DefaultSplitFactoryBuilder.swift +++ b/Split/Api/DefaultSplitFactoryBuilder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Default implementation of factory builder. diff --git a/Split/Api/DefaultSplitManager.swift b/Split/Api/DefaultSplitManager.swift index 525518214..7d4657cfd 100644 --- a/Split/Api/DefaultSplitManager.swift +++ b/Split/Api/DefaultSplitManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Default implementation of SplitManager protocol diff --git a/Split/Api/EventsTracker.swift b/Split/Api/EventsTracker.swift index d273a5fd8..b02654ea4 100644 --- a/Split/Api/EventsTracker.swift +++ b/Split/Api/EventsTracker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol EventsTracker: AnyObject { var isTrackingEnabled: Bool { get set } diff --git a/Split/Api/FilterBuilder.swift b/Split/Api/FilterBuilder.swift index e9c2bdcfc..dd5bae79a 100644 --- a/Split/Api/FilterBuilder.swift +++ b/Split/Api/FilterBuilder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging enum FilterError: Error { case maxFilterValuesExceded(message: String) diff --git a/Split/Api/FlagSetsValidator.swift b/Split/Api/FlagSetsValidator.swift index 4b6a91fc1..8d821fc63 100644 --- a/Split/Api/FlagSetsValidator.swift +++ b/Split/Api/FlagSetsValidator.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol FlagSetsValidator { func validateOnEvaluation(_ values: [String], calledFrom method: String, setsInFilter: [String]) -> [String] diff --git a/Split/Api/LocalhostSplitFactory.swift b/Split/Api/LocalhostSplitFactory.swift index 29794bde4..1347514fc 100644 --- a/Split/Api/LocalhostSplitFactory.swift +++ b/Split/Api/LocalhostSplitFactory.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// SplitFactory implementation for Localhost mode diff --git a/Split/Api/RolloutCacheConfiguration.swift b/Split/Api/RolloutCacheConfiguration.swift index 73e539836..de00157a5 100644 --- a/Split/Api/RolloutCacheConfiguration.swift +++ b/Split/Api/RolloutCacheConfiguration.swift @@ -1,5 +1,4 @@ import Foundation -import Logging /// Configuration class for rollout cache. Internal use only. @objc public class RolloutCacheConfiguration: NSObject { diff --git a/Split/Api/SplitClientConfig.swift b/Split/Api/SplitClientConfig.swift index 02f223866..e13704b15 100644 --- a/Split/Api/SplitClientConfig.swift +++ b/Split/Api/SplitClientConfig.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging public typealias SplitImpressionListener = (SplitImpression) -> Void diff --git a/Split/Api/SplitClientManager.swift b/Split/Api/SplitClientManager.swift index 1f83855a4..db20eec6c 100644 --- a/Split/Api/SplitClientManager.swift +++ b/Split/Api/SplitClientManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SplitClientManager: AnyObject { var defaultClient: SplitClient? { get } diff --git a/Split/Api/SplitDatabaseHelper.swift b/Split/Api/SplitDatabaseHelper.swift index 7e698b70a..f18324373 100644 --- a/Split/Api/SplitDatabaseHelper.swift +++ b/Split/Api/SplitDatabaseHelper.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging struct SplitDatabaseHelper { static private let kDbMagicCharsCount = 4 diff --git a/Split/Api/SyncConfig.swift b/Split/Api/SyncConfig.swift index a4079614e..6f488310c 100644 --- a/Split/Api/SyncConfig.swift +++ b/Split/Api/SyncConfig.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging @objc public class SyncConfig: NSObject { private(set) var filters: [SplitFilter] diff --git a/Split/Api/UserConsentManager.swift b/Split/Api/UserConsentManager.swift index 4eeb85de1..1596cb7cb 100644 --- a/Split/Api/UserConsentManager.swift +++ b/Split/Api/UserConsentManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol UserConsentManager: AnyObject { func set(_ status: UserConsent) diff --git a/Split/Common/Extensions/Array+DynamicCodable.swift b/Split/Common/Extensions/Array+DynamicCodable.swift index 77d99d6ec..ab81ebe40 100644 --- a/Split/Common/Extensions/Array+DynamicCodable.swift +++ b/Split/Common/Extensions/Array+DynamicCodable.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging extension Array: DynamicEncodable where Element: DynamicEncodable { func toJsonObject() -> Any { diff --git a/Split/Common/Extensions/Dictionary+DynamicCodable.swift b/Split/Common/Extensions/Dictionary+DynamicCodable.swift index ca1c7a785..fb46b8339 100644 --- a/Split/Common/Extensions/Dictionary+DynamicCodable.swift +++ b/Split/Common/Extensions/Dictionary+DynamicCodable.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging extension Dictionary: DynamicEncodable where Key: Hashable, Value: DynamicEncodable { func toJsonObject() -> Any { diff --git a/Split/Common/Extensions/String+Utils.swift b/Split/Common/Extensions/String+Utils.swift index d78f5517e..280011958 100644 --- a/Split/Common/Extensions/String+Utils.swift +++ b/Split/Common/Extensions/String+Utils.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging extension Substring { func asString() -> String { diff --git a/Split/Common/Utils/Cipher.swift b/Split/Common/Utils/Cipher.swift index a4538598c..78511df74 100644 --- a/Split/Common/Utils/Cipher.swift +++ b/Split/Common/Utils/Cipher.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CommonCrypto protocol KeyGenerator { diff --git a/Split/Common/Utils/CompressionUtil.swift b/Split/Common/Utils/CompressionUtil.swift index 5410e7ff4..42de5c394 100644 --- a/Split/Common/Utils/CompressionUtil.swift +++ b/Split/Common/Utils/CompressionUtil.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import Compression enum CompressionType: Decodable { diff --git a/Split/Common/Utils/DbCipher.swift b/Split/Common/Utils/DbCipher.swift index de9877c63..afdd92be4 100644 --- a/Split/Common/Utils/DbCipher.swift +++ b/Split/Common/Utils/DbCipher.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData struct DbCipher { diff --git a/Split/Common/Utils/DbEncryptionManager.swift b/Split/Common/Utils/DbEncryptionManager.swift index 40fa45b10..52ede2b21 100644 --- a/Split/Common/Utils/DbEncryptionManager.swift +++ b/Split/Common/Utils/DbEncryptionManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging struct DbEncryptionManager { diff --git a/Split/Common/Utils/FileUtil.swift b/Split/Common/Utils/FileUtil.swift index 44e263808..3ac40937d 100644 --- a/Split/Common/Utils/FileUtil.swift +++ b/Split/Common/Utils/FileUtil.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging // FileHelper struct FileUtil { diff --git a/Split/Common/Utils/InfoUtils.swift b/Split/Common/Utils/InfoUtils.swift index d63fd1b36..53e97c35f 100644 --- a/Split/Common/Utils/InfoUtils.swift +++ b/Split/Common/Utils/InfoUtils.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class InfoUtils { diff --git a/Split/Common/Utils/NotificationsHelper.swift b/Split/Common/Utils/NotificationsHelper.swift index e5a88811c..b7b51a01f 100644 --- a/Split/Common/Utils/NotificationsHelper.swift +++ b/Split/Common/Utils/NotificationsHelper.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging #if canImport(UIKit) import UIKit diff --git a/Split/Common/Utils/ThreadUtils.swift b/Split/Common/Utils/ThreadUtils.swift index 1ed530c8b..01ce9a2f2 100644 --- a/Split/Common/Utils/ThreadUtils.swift +++ b/Split/Common/Utils/ThreadUtils.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class ThreadUtils { static func delay(seconds: Double) { diff --git a/Split/Common/Validators/PropertyValidator.swift b/Split/Common/Validators/PropertyValidator.swift index 77acda8a2..d731f259f 100644 --- a/Split/Common/Validators/PropertyValidator.swift +++ b/Split/Common/Validators/PropertyValidator.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol PropertyValidator { /// Validates properties for events and impressions diff --git a/Split/Common/Validators/ValidatorMessageLogger.swift b/Split/Common/Validators/ValidatorMessageLogger.swift index fc7eddbc0..78e89f778 100644 --- a/Split/Common/Validators/ValidatorMessageLogger.swift +++ b/Split/Common/Validators/ValidatorMessageLogger.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Tags to use when logging message on validation diff --git a/Split/Engine/DefaultTreatmentManager.swift b/Split/Engine/DefaultTreatmentManager.swift index f364e6820..0d80d1192 100644 --- a/Split/Engine/DefaultTreatmentManager.swift +++ b/Split/Engine/DefaultTreatmentManager.swift @@ -6,7 +6,6 @@ // Copyright © 2019 Split. All rights reserved. import Foundation -import Logging class DefaultTreatmentManager: TreatmentManager, @unchecked Sendable { diff --git a/Split/Engine/Evaluator.swift b/Split/Engine/Evaluator.swift index 233cc6790..826d4534c 100644 --- a/Split/Engine/Evaluator.swift +++ b/Split/Engine/Evaluator.swift @@ -1,7 +1,6 @@ // Created by Natalia Stele on 11/14/17 import Foundation -import Logging // swiftlint:disable function_body_length protocol Evaluator { diff --git a/Split/Engine/FallbackTreatments/FallbackSanitizer.swift b/Split/Engine/FallbackTreatments/FallbackSanitizer.swift index 922a10ce6..93117b4ff 100644 --- a/Split/Engine/FallbackTreatments/FallbackSanitizer.swift +++ b/Split/Engine/FallbackTreatments/FallbackSanitizer.swift @@ -1,7 +1,6 @@ // Created by Martin Cardozo on 26/08/2025 import Foundation -import Logging final class FallbackSanitizer: NSObject { diff --git a/Split/Engine/FallbackTreatments/FallbackTreatments.swift b/Split/Engine/FallbackTreatments/FallbackTreatments.swift index 4390bfbbc..c6faafb0b 100644 --- a/Split/Engine/FallbackTreatments/FallbackTreatments.swift +++ b/Split/Engine/FallbackTreatments/FallbackTreatments.swift @@ -1,7 +1,6 @@ // Created by Martin Cardozo on 25/08/2025 import Foundation -import Logging /// A class that represents a fallback treatment configuration for feature flags. /// diff --git a/Split/Engine/Hashing/Murmur64x128.swift b/Split/Engine/Hashing/Murmur64x128.swift index 152f20068..2ac23a21a 100644 --- a/Split/Engine/Hashing/Murmur64x128.swift +++ b/Split/Engine/Hashing/Murmur64x128.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class Murmur64x128 { /// diff --git a/Split/Events/SplitEventActionTask.swift b/Split/Events/SplitEventActionTask.swift index 2b6279a57..f434246fb 100644 --- a/Split/Events/SplitEventActionTask.swift +++ b/Split/Events/SplitEventActionTask.swift @@ -1,7 +1,6 @@ // Created by Javier L. Avrudsky on 7/6/18 import Foundation -import Logging internal typealias SplitActionWithMetadata = @Sendable (T) -> () diff --git a/Split/Events/SplitEventsManager.swift b/Split/Events/SplitEventsManager.swift index c35c69e63..3b5fb5e4e 100644 --- a/Split/Events/SplitEventsManager.swift +++ b/Split/Events/SplitEventsManager.swift @@ -7,7 +7,6 @@ // Update: Replacing timer by blocking queue. 05-10-2021 // import Foundation -import Logging protocol SplitEventsManager: AnyObject, Sendable { func register(event: SplitEvent, task: SplitEventTask) diff --git a/Split/FetcherEngine/HttpMySegmentsFetcher.swift b/Split/FetcherEngine/HttpMySegmentsFetcher.swift index c944fd0ea..5a410a6f7 100644 --- a/Split/FetcherEngine/HttpMySegmentsFetcher.swift +++ b/Split/FetcherEngine/HttpMySegmentsFetcher.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol HttpMySegmentsFetcher { func execute(userKey: String, till: Int64?, headers: [String: String]?) throws -> AllSegmentsChange? diff --git a/Split/FetcherEngine/HttpSplitFetcher.swift b/Split/FetcherEngine/HttpSplitFetcher.swift index abf44f358..2a1a34dde 100644 --- a/Split/FetcherEngine/HttpSplitFetcher.swift +++ b/Split/FetcherEngine/HttpSplitFetcher.swift @@ -5,7 +5,6 @@ // Created by Javier Avrudsky on 02-Dic-2020 import Foundation -import Logging protocol HttpSplitFetcher { func execute(since: Int64, rbSince: Int64?, till: Int64?, headers: HttpHeaders?, spec: String?) throws -> TargetingRulesChange diff --git a/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift b/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift index 6cfe2f401..8233aaa00 100644 --- a/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/EventsRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class EventsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift b/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift index 88fb18e52..57c4ed21a 100644 --- a/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/ImpressionsCountRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class ImpressionsCountRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift b/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift index c38974cd7..28b1d64bf 100644 --- a/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/ImpressionsRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class ImpressionsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift b/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift index 04edb7c9e..25e761141 100644 --- a/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/TelemetryConfigRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class TelemetryConfigRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift b/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift index 4528cc5a7..26e847bfb 100644 --- a/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift +++ b/Split/FetcherEngine/Recorder/TelemetryStatsRecorder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol HttpTelemetryStatsRecorder { func isEndpointAvailable() -> Bool diff --git a/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift b/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift index 997142033..e52845046 100644 --- a/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/TelemetryStatsRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class TelemetryStatsRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift b/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift index d271c2e9a..251e3fa6d 100644 --- a/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift +++ b/Split/FetcherEngine/Recorder/UniqueKeysRecorderWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class UniqueKeysRecorderWorker: RecorderWorker, @unchecked Sendable { diff --git a/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift b/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift index b92e4c936..b357b96c8 100644 --- a/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/BackgroundSyncWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol BackgroundSyncWorker { func execute() diff --git a/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift b/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift index 82d7609f6..1bc0ffc49 100644 --- a/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/PeriodicSyncWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol PeriodicTimer { func trigger() func stop() diff --git a/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift b/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift index d4f38eb0e..a0ba8ef10 100644 --- a/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/RetryableSegmentsSyncWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Retrieves segments changes or a user key diff --git a/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift b/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift index 1f78ddc57..531e35395 100644 --- a/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift +++ b/Split/FetcherEngine/Refresh/RetryableSyncWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RetryableSyncWorker: Sendable { typealias SyncCompletion = (Bool) -> Void diff --git a/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift b/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift index e16c79c14..13eec379d 100644 --- a/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift +++ b/Split/FetcherEngine/Refresh/SplitBgSynchronizer.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging #if os(iOS) || os(tvOS) @preconcurrency import BackgroundTasks diff --git a/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift b/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift index 0241d8e8a..9666d2049 100644 --- a/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift +++ b/Split/FetcherEngine/Refresh/SplitsSyncHelper.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging struct SyncResult { let success: Bool diff --git a/Split/FetcherEngine/SyncHelper.swift b/Split/FetcherEngine/SyncHelper.swift index 21570b8c5..95c0316d5 100644 --- a/Split/FetcherEngine/SyncHelper.swift +++ b/Split/FetcherEngine/SyncHelper.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SyncHelper { func checkEndpointReachability(restClient: RestClient, resource: Resource) throws diff --git a/Split/Initialization/RolloutCacheManager.swift b/Split/Initialization/RolloutCacheManager.swift index 17d7ea64e..44f3fff5e 100644 --- a/Split/Initialization/RolloutCacheManager.swift +++ b/Split/Initialization/RolloutCacheManager.swift @@ -1,5 +1,4 @@ import Foundation -import Logging protocol RolloutCacheManager { func validateCache(listener: (() -> Void)) diff --git a/Split/Localhost/LocalhostClientManager.swift b/Split/Localhost/LocalhostClientManager.swift index ec311fb7a..3e18faf8f 100644 --- a/Split/Localhost/LocalhostClientManager.swift +++ b/Split/Localhost/LocalhostClientManager.swift @@ -6,7 +6,6 @@ // Copyright © 2024 Split. All rights reserved. import Foundation -import Logging class LocalhostClientManager: SplitClientManager, @unchecked Sendable { diff --git a/Split/Localhost/LocalhostFileDataSource.swift b/Split/Localhost/LocalhostFileDataSource.swift index afca03a27..f5017b22d 100644 --- a/Split/Localhost/LocalhostFileDataSource.swift +++ b/Split/Localhost/LocalhostFileDataSource.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol LocalhostDataSource: AnyObject { typealias IncomingDataHandler = ([String: Split]?) -> Void diff --git a/Split/Localhost/LocalhostSplitsParser.swift b/Split/Localhost/LocalhostSplitsParser.swift index 2ec7e8de0..b9e5f09a1 100644 --- a/Split/Localhost/LocalhostSplitsParser.swift +++ b/Split/Localhost/LocalhostSplitsParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /** Data structure to hold parsed feature flags and its corresponding treatment */ diff --git a/Split/Localhost/LocalhostSynchronizer.swift b/Split/Localhost/LocalhostSynchronizer.swift index 4fe7b3a11..819879cad 100644 --- a/Split/Localhost/LocalhostSynchronizer.swift +++ b/Split/Localhost/LocalhostSynchronizer.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class LocalhostSynchronizer: FeatureFlagsSynchronizer, @unchecked Sendable { diff --git a/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift b/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift index 729093449..a9711496e 100644 --- a/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift +++ b/Split/Localhost/SpaceDelimitedLocalhostSplitsParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class SpaceDelimitedLocalhostSplitsParser: LocalhostSplitsParser { diff --git a/Split/Localhost/YamlLocalhostSplitsParser.swift b/Split/Localhost/YamlLocalhostSplitsParser.swift index 21f4a5285..58ec33256 100644 --- a/Split/Localhost/YamlLocalhostSplitsParser.swift +++ b/Split/Localhost/YamlLocalhostSplitsParser.swift @@ -6,7 +6,6 @@ // Copyright © 2019 Split. All rights reserved. import Foundation -import Logging class YamlLocalhostSplitsParser: LocalhostSplitsParser { diff --git a/Split/Matchers/InRuleBasedSegmentMatcher.swift b/Split/Matchers/InRuleBasedSegmentMatcher.swift index 44779386a..1560c1880 100644 --- a/Split/Matchers/InRuleBasedSegmentMatcher.swift +++ b/Split/Matchers/InRuleBasedSegmentMatcher.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class InRuleBasedSegmentMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/PrerequisitesMatcher.swift b/Split/Matchers/PrerequisitesMatcher.swift index 88e361b37..7a5470df0 100644 --- a/Split/Matchers/PrerequisitesMatcher.swift +++ b/Split/Matchers/PrerequisitesMatcher.swift @@ -2,7 +2,6 @@ // Copyright © 2025 Split. All rights reserved. import Foundation -import Logging class PrerequisitesMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/BetweenSemverMatcher.swift b/Split/Matchers/Semver/BetweenSemverMatcher.swift index 3449947a0..f4d5efc08 100644 --- a/Split/Matchers/Semver/BetweenSemverMatcher.swift +++ b/Split/Matchers/Semver/BetweenSemverMatcher.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class BetweenSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/EqualToSemverMatcher.swift b/Split/Matchers/Semver/EqualToSemverMatcher.swift index df54f40de..efc23a9d7 100644 --- a/Split/Matchers/Semver/EqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/EqualToSemverMatcher.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class EqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift b/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift index 65f75269a..f92a44ee6 100644 --- a/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/GreaterThanOrEqualToSemverMatcher.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class GreaterThanOrEqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift b/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift index 50985120a..f4ebf781b 100644 --- a/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift +++ b/Split/Matchers/Semver/LessThanOrEqualToSemverMatcher.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class LessThanOrEqualToSemverMatcher: BaseMatcher, MatcherProtocol { diff --git a/Split/Matchers/Semver/Semver.swift b/Split/Matchers/Semver/Semver.swift index ba7c0ea0b..ee5c3b827 100644 --- a/Split/Matchers/Semver/Semver.swift +++ b/Split/Matchers/Semver/Semver.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging enum SemverParseError: Error { case invalidVersionFormat(String) diff --git a/Split/Network/HttpClient/HttpClient.swift b/Split/Network/HttpClient/HttpClient.swift index cd3c53500..cc42d6625 100644 --- a/Split/Network/HttpClient/HttpClient.swift +++ b/Split/Network/HttpClient/HttpClient.swift @@ -5,7 +5,6 @@ // Created by Javier L. Avrudsky on 5/23/18. import Foundation -import Logging // MARK: HttpSession diff --git a/Split/Network/HttpClient/HttpRequest.swift b/Split/Network/HttpClient/HttpRequest.swift index 83b59e02e..6cae96063 100644 --- a/Split/Network/HttpClient/HttpRequest.swift +++ b/Split/Network/HttpClient/HttpRequest.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging protocol HttpRequest: Sendable { typealias RequestCompletionHandler = (HttpResponse) -> Void diff --git a/Split/Network/HttpClient/HttpRequestManager.swift b/Split/Network/HttpClient/HttpRequestManager.swift index 8a7a038a6..f5f59f1a3 100644 --- a/Split/Network/HttpClient/HttpRequestManager.swift +++ b/Split/Network/HttpClient/HttpRequestManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Stores sent requests in a list diff --git a/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift b/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift index 5ad8d93af..2fadcce0d 100644 --- a/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift +++ b/Split/Network/HttpClient/OutdatedSplitProxyHandler.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// Handles proxy spec fallback and recovery. /// diff --git a/Split/Network/RestClient/RestClient+Impressions.swift b/Split/Network/RestClient/RestClient+Impressions.swift index 5493453f4..aaa38213d 100644 --- a/Split/Network/RestClient/RestClient+Impressions.swift +++ b/Split/Network/RestClient/RestClient+Impressions.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientImpressions: RestClient { func sendImpressions(impressions: [ImpressionsTest], completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+ImpressionsCount.swift b/Split/Network/RestClient/RestClient+ImpressionsCount.swift index fa5021e1c..bddd164f8 100644 --- a/Split/Network/RestClient/RestClient+ImpressionsCount.swift +++ b/Split/Network/RestClient/RestClient+ImpressionsCount.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientImpressionsCount: RestClient { func send(counts: ImpressionsCount, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TelemetryConfig.swift b/Split/Network/RestClient/RestClient+TelemetryConfig.swift index 05fdd35a4..c2bd19f11 100644 --- a/Split/Network/RestClient/RestClient+TelemetryConfig.swift +++ b/Split/Network/RestClient/RestClient+TelemetryConfig.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientTelemetryConfig: RestClient { func send(config: TelemetryConfig, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TelemetryStats.swift b/Split/Network/RestClient/RestClient+TelemetryStats.swift index 1dd7229ce..cff1a8f2d 100644 --- a/Split/Network/RestClient/RestClient+TelemetryStats.swift +++ b/Split/Network/RestClient/RestClient+TelemetryStats.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientTelemetryStats: RestClient { func send(stats: TelemetryStats, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+TrackEvents.swift b/Split/Network/RestClient/RestClient+TrackEvents.swift index 3a6fd783a..5d032e311 100644 --- a/Split/Network/RestClient/RestClient+TrackEvents.swift +++ b/Split/Network/RestClient/RestClient+TrackEvents.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientTrackEvents: RestClient { func sendTrackEvents(events: [EventDTO], completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient+UniqueKeys.swift b/Split/Network/RestClient/RestClient+UniqueKeys.swift index 39f6a588b..0f2864604 100644 --- a/Split/Network/RestClient/RestClient+UniqueKeys.swift +++ b/Split/Network/RestClient/RestClient+UniqueKeys.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClientUniqueKeys: RestClient { func send(uniqueKeys: UniqueKeys, completion: @escaping (DataResult) -> Void) diff --git a/Split/Network/RestClient/RestClient.swift b/Split/Network/RestClient/RestClient.swift index cecf85de8..694a273ef 100644 --- a/Split/Network/RestClient/RestClient.swift +++ b/Split/Network/RestClient/RestClient.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RestClient { func isServerAvailable(_ url: URL) -> Bool diff --git a/Split/Network/Security/TlsPinChecker.swift b/Split/Network/Security/TlsPinChecker.swift index f04a998b3..50fbb9a8a 100644 --- a/Split/Network/Security/TlsPinChecker.swift +++ b/Split/Network/Security/TlsPinChecker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CommonCrypto enum PinType { diff --git a/Split/Network/Streaming/BackoffCounterTimer.swift b/Split/Network/Streaming/BackoffCounterTimer.swift index 1d4404408..b9e52d15a 100644 --- a/Split/Network/Streaming/BackoffCounterTimer.swift +++ b/Split/Network/Streaming/BackoffCounterTimer.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol BackoffCounterTimer { func schedule(handler: @escaping @Sendable () -> Void) diff --git a/Split/Network/Streaming/DefaultSseNotificationParser.swift b/Split/Network/Streaming/DefaultSseNotificationParser.swift index 1ac7e8d44..c5c0bea39 100644 --- a/Split/Network/Streaming/DefaultSseNotificationParser.swift +++ b/Split/Network/Streaming/DefaultSseNotificationParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SseNotificationParser { diff --git a/Split/Network/Streaming/JwtTokenParser.swift b/Split/Network/Streaming/JwtTokenParser.swift index 4797445a1..e43cb347a 100644 --- a/Split/Network/Streaming/JwtTokenParser.swift +++ b/Split/Network/Streaming/JwtTokenParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging enum JwtTokenError: Error { case tokenIsNull diff --git a/Split/Network/Streaming/NotificationManagerKeeper.swift b/Split/Network/Streaming/NotificationManagerKeeper.swift index 4912ee764..25a78b7a3 100644 --- a/Split/Network/Streaming/NotificationManagerKeeper.swift +++ b/Split/Network/Streaming/NotificationManagerKeeper.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol NotificationManagerKeeper { var isStreamingActive: Bool { get } diff --git a/Split/Network/Streaming/PushNotificationManager.swift b/Split/Network/Streaming/PushNotificationManager.swift index 7ee398be2..e47a923ce 100644 --- a/Split/Network/Streaming/PushNotificationManager.swift +++ b/Split/Network/Streaming/PushNotificationManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol PushNotificationManager { // Visible for testing. Make possible to inject stub diff --git a/Split/Network/Streaming/SseClient.swift b/Split/Network/Streaming/SseClient.swift index fe0ccc0fb..878afae9c 100644 --- a/Split/Network/Streaming/SseClient.swift +++ b/Split/Network/Streaming/SseClient.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging struct SseClientConstants { static let pushNotificationChannelsParam = "channels" diff --git a/Split/Network/Streaming/SseConnectionHandler.swift b/Split/Network/Streaming/SseConnectionHandler.swift index 9f4f5a202..0349ae69f 100644 --- a/Split/Network/Streaming/SseConnectionHandler.swift +++ b/Split/Network/Streaming/SseConnectionHandler.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class SseConnectionHandler: @unchecked Sendable { private let clientLock = NSLock() diff --git a/Split/Network/Streaming/SseHandler.swift b/Split/Network/Streaming/SseHandler.swift index 186fc4346..38edf718e 100644 --- a/Split/Network/Streaming/SseHandler.swift +++ b/Split/Network/Streaming/SseHandler.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SseHandler { func isConnectionConfirmed(message: [String: String]) -> Bool diff --git a/Split/Network/Streaming/SseNotificationProcessor.swift b/Split/Network/Streaming/SseNotificationProcessor.swift index e8943f1ff..35cccbd10 100644 --- a/Split/Network/Streaming/SseNotificationProcessor.swift +++ b/Split/Network/Streaming/SseNotificationProcessor.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SseNotificationProcessor { func process(_ notification: IncomingNotification) diff --git a/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift b/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift index fb920a4f2..7344ea532 100644 --- a/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift +++ b/Split/Network/Streaming/SyncSegmentsUpdateWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging class SegmentsUpdateWorker: UpdateWorker, @unchecked Sendable { diff --git a/Split/Network/Streaming/SyncUpdateWorker.swift b/Split/Network/Streaming/SyncUpdateWorker.swift index e6763cd3d..1192e61d4 100644 --- a/Split/Network/Streaming/SyncUpdateWorker.swift +++ b/Split/Network/Streaming/SyncUpdateWorker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging /// /// Swift doesn't allow dynamic dispatch diff --git a/Split/Network/Sync/FeatureFlagsSynchronizer.swift b/Split/Network/Sync/FeatureFlagsSynchronizer.swift index 2410cf93d..f23d59c67 100644 --- a/Split/Network/Sync/FeatureFlagsSynchronizer.swift +++ b/Split/Network/Sync/FeatureFlagsSynchronizer.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol FeatureFlagsSynchronizer { func load() diff --git a/Split/Network/Sync/ImpressionsTracker.swift b/Split/Network/Sync/ImpressionsTracker.swift index 23de81af1..4f884a99d 100644 --- a/Split/Network/Sync/ImpressionsTracker.swift +++ b/Split/Network/Sync/ImpressionsTracker.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging enum RecordingService { case uniqueKeys diff --git a/Split/Network/Sync/SyncManager.swift b/Split/Network/Sync/SyncManager.swift index cc4c146a5..8cdf4a3d0 100644 --- a/Split/Network/Sync/SyncManager.swift +++ b/Split/Network/Sync/SyncManager.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SyncManager { func start() diff --git a/Split/Secure/SecureDataStore.swift b/Split/Secure/SecureDataStore.swift index bd7bf1384..4bd8c8e38 100644 --- a/Split/Secure/SecureDataStore.swift +++ b/Split/Secure/SecureDataStore.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class SecureDataStore: @unchecked Sendable { diff --git a/Split/Storage/Attributes/AttributesDao.swift b/Split/Storage/Attributes/AttributesDao.swift index 817985e8c..64f41b12a 100644 --- a/Split/Storage/Attributes/AttributesDao.swift +++ b/Split/Storage/Attributes/AttributesDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol AttributesDao { diff --git a/Split/Storage/CoreDataContextBuilder.swift b/Split/Storage/CoreDataContextBuilder.swift index c86978a9b..02f4c9dfd 100644 --- a/Split/Storage/CoreDataContextBuilder.swift +++ b/Split/Storage/CoreDataContextBuilder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData class CoreDataHelperBuilder { diff --git a/Split/Storage/CoreDataHelper.swift b/Split/Storage/CoreDataHelper.swift index de502de0c..c7c3baf7d 100644 --- a/Split/Storage/CoreDataHelper.swift +++ b/Split/Storage/CoreDataHelper.swift @@ -6,7 +6,6 @@ // Copyright © 2020 Split. All rights reserved. // import CoreData -import Logging enum CoreDataEntity: String { case event = "Event" diff --git a/Split/Storage/DefaultFileStorage.swift b/Split/Storage/DefaultFileStorage.swift index 731d323ea..fc5fc5ff1 100644 --- a/Split/Storage/DefaultFileStorage.swift +++ b/Split/Storage/DefaultFileStorage.swift @@ -6,7 +6,6 @@ // import Foundation -import Logging class DefaultFileStorage: FileStorage, @unchecked Sendable { diff --git a/Split/Storage/Events/EventDao.swift b/Split/Storage/Events/EventDao.swift index 70a4f78d9..49a3a8080 100644 --- a/Split/Storage/Events/EventDao.swift +++ b/Split/Storage/Events/EventDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol EventDao { diff --git a/Split/Storage/Events/EventsStorage.swift b/Split/Storage/Events/EventsStorage.swift index 9174dedbe..86c35bb21 100644 --- a/Split/Storage/Events/EventsStorage.swift +++ b/Split/Storage/Events/EventsStorage.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol EventsStorage { func enablePersistence(_ enable: Bool) diff --git a/Split/Storage/Global/GlobalSecureStorage.swift b/Split/Storage/Global/GlobalSecureStorage.swift index 585933564..407997ee1 100644 --- a/Split/Storage/Global/GlobalSecureStorage.swift +++ b/Split/Storage/Global/GlobalSecureStorage.swift @@ -6,7 +6,6 @@ // Copyright © 2021 Split. All rights reserved. // import Foundation -import Logging class GlobalSecureStorage: KeyValueStorage, @unchecked Sendable { diff --git a/Split/Storage/HashedImpression/HashedImpressionStorage.swift b/Split/Storage/HashedImpression/HashedImpressionStorage.swift index 879edc9ac..04e92811c 100644 --- a/Split/Storage/HashedImpression/HashedImpressionStorage.swift +++ b/Split/Storage/HashedImpression/HashedImpressionStorage.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol HashedImpressionsStorage { func loadFromDb() diff --git a/Split/Storage/Impressions/ImpressionDao.swift b/Split/Storage/Impressions/ImpressionDao.swift index 514d59c2d..d4b955e71 100644 --- a/Split/Storage/Impressions/ImpressionDao.swift +++ b/Split/Storage/Impressions/ImpressionDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol ImpressionDao { diff --git a/Split/Storage/Impressions/ImpressionsCountDao.swift b/Split/Storage/Impressions/ImpressionsCountDao.swift index e5fdb2243..b983b2643 100644 --- a/Split/Storage/Impressions/ImpressionsCountDao.swift +++ b/Split/Storage/Impressions/ImpressionsCountDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol ImpressionsCountDao { diff --git a/Split/Storage/Impressions/ImpressionsMode.swift b/Split/Storage/Impressions/ImpressionsMode.swift index 36fdb82e8..49ccc4200 100644 --- a/Split/Storage/Impressions/ImpressionsMode.swift +++ b/Split/Storage/Impressions/ImpressionsMode.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging public enum ImpressionsMode: String { case optimized = "OPTIMIZED" diff --git a/Split/Storage/Impressions/ImpressionsStorage.swift b/Split/Storage/Impressions/ImpressionsStorage.swift index 5c9db7773..d4b806aa6 100644 --- a/Split/Storage/Impressions/ImpressionsStorage.swift +++ b/Split/Storage/Impressions/ImpressionsStorage.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol ImpressionsStorage { func enablePersistence(_ enable: Bool) diff --git a/Split/Storage/MySegments/MySegmentsDao.swift b/Split/Storage/MySegments/MySegmentsDao.swift index 3ec66f16c..93ccf0d57 100644 --- a/Split/Storage/MySegments/MySegmentsDao.swift +++ b/Split/Storage/MySegments/MySegmentsDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol MySegmentsDao { diff --git a/Split/Storage/PersistenceBreaker.swift b/Split/Storage/PersistenceBreaker.swift index 91f6c006b..dd58042b5 100644 --- a/Split/Storage/PersistenceBreaker.swift +++ b/Split/Storage/PersistenceBreaker.swift @@ -5,7 +5,6 @@ // import Foundation -import Logging /// Protocol for controlling persistence behavior in response to failures. /// diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift index 6553d0c5b..1de16b9b4 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol RuleBasedSegmentDao { diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift index fb70c5263..9c9cf0d7a 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsDecoder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RuleBasedSegmentsDecoder { func decode(_ jsonSegments: [String]) -> [RuleBasedSegment] diff --git a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift index c515dd11c..104a05a1e 100644 --- a/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift +++ b/Split/Storage/RuleBasedSegments/RuleBasedSegmentsEncoder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol RuleBasedSegmentsEncoder { func encode(_ segments: [RuleBasedSegment]) -> [String: String] diff --git a/Split/Storage/Splits/PersistentSplitsStorage.swift b/Split/Storage/Splits/PersistentSplitsStorage.swift index 6b355f0ce..25bb23259 100644 --- a/Split/Storage/Splits/PersistentSplitsStorage.swift +++ b/Split/Storage/Splits/PersistentSplitsStorage.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol PersistentSplitsStorage { func update(splitChange: ProcessedSplitChange, onFailure: ((Error) -> Void)?) diff --git a/Split/Storage/Splits/SplitDao.swift b/Split/Storage/Splits/SplitDao.swift index 2ce5235f9..fc9d610c0 100644 --- a/Split/Storage/Splits/SplitDao.swift +++ b/Split/Storage/Splits/SplitDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol SplitDao { diff --git a/Split/Storage/Splits/SplitsDecoder.swift b/Split/Storage/Splits/SplitsDecoder.swift index e53646457..ad026392c 100644 --- a/Split/Storage/Splits/SplitsDecoder.swift +++ b/Split/Storage/Splits/SplitsDecoder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SplitsDecoder { func decode(_ list: [String]) -> [Split] diff --git a/Split/Storage/Splits/SplitsEncoder.swift b/Split/Storage/Splits/SplitsEncoder.swift index 4eaae2944..48b48402c 100644 --- a/Split/Storage/Splits/SplitsEncoder.swift +++ b/Split/Storage/Splits/SplitsEncoder.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SplitsEncoder { func encode(_ list: [Split]) -> [String: String] diff --git a/Split/Storage/Splits/SplitsStorage.swift b/Split/Storage/Splits/SplitsStorage.swift index c284c15d2..49ef8b56b 100644 --- a/Split/Storage/Splits/SplitsStorage.swift +++ b/Split/Storage/Splits/SplitsStorage.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging protocol SyncSplitsStorage: RolloutDefinitionsCache { func update(splitChange: ProcessedSplitChange) -> Bool diff --git a/Split/Storage/UniqueKeys/UniqueKeyDao.swift b/Split/Storage/UniqueKeys/UniqueKeyDao.swift index 0ca62d830..b0d9c42ee 100644 --- a/Split/Storage/UniqueKeys/UniqueKeyDao.swift +++ b/Split/Storage/UniqueKeys/UniqueKeyDao.swift @@ -7,7 +7,6 @@ // import Foundation -import Logging import CoreData protocol UniqueKeyDao { From 200833a6805a67131723e7a12aeac2d249c20d14 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 23:00:43 -0300 Subject: [PATCH 06/18] Restore Split Logger shim --- Split/Common/Utils/Logger.swift | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Split/Common/Utils/Logger.swift diff --git a/Split/Common/Utils/Logger.swift b/Split/Common/Utils/Logger.swift new file mode 100644 index 000000000..7548bdbd4 --- /dev/null +++ b/Split/Common/Utils/Logger.swift @@ -0,0 +1,69 @@ +// +// Logger.swift +// Split +// +// Created by Sebastian Arrubia on 3/5/18. +// + +import Foundation +import Logging + +// Re-export Logger from Logging module for backward compatibility +// This allows existing Split code to continue using Logger.* without changes +typealias Logger = Logging.Logger + +/// Split's implementation of DateProvider using Date+Utils extensions. +/// Declared here to ensure it's compiled as part of Split's sources when building with Xcode. +struct SplitDateProvider: DateProvider { + func nowMillis() -> Int64 { + Date.nowMillis() + } + + func nowLabel() -> String { + Date.nowLabel() + } +} + +// Initialize Logger with Split's DateProvider on first access +private let loggerInitializer: Void = { + Logger.shared.dateProvider = SplitDateProvider() +}() + +// Ensure logger is initialized when Split module loads +extension Logger { + static func ensureInitialized() { + _ = loggerInitializer + } +} + +// Use Logging's TimeChecker implementation. +// We keep these overloads to preserve Split's call sites AND to ensure the DateProvider is injected first. +typealias TimeChecker = Logging.TimeChecker + +extension Logging.TimeChecker { + static func start() { + Logger.ensureInitialized() + Self.start(dateProvider: nil) + } + + static func logInterval(_ msg: String) { + Logger.ensureInitialized() + Self.logInterval(msg, dateProvider: nil) + } + + static func logTime(_ msg: String) { + Logger.ensureInitialized() + Self.logTime(msg, dateProvider: nil) + } + + static func logInterval(_ msg: String, startTime: Int64) { + Logger.ensureInitialized() + Self.logInterval(msg, startTime: startTime, dateProvider: nil) + } +} + +// LogPrinter and DefaultLogPrinter are now in the Logging module +// Re-export for backward compatibility +typealias LogPrinter = Logging.LogPrinter +typealias DefaultLogPrinter = Logging.DefaultLogPrinter + From 7dd76dd349ddd0b10b74c492cce70a27e9ba27bd Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 23:02:35 -0300 Subject: [PATCH 07/18] Fix comments --- Split/Common/Utils/Logger.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Split/Common/Utils/Logger.swift b/Split/Common/Utils/Logger.swift index 7548bdbd4..984b7e916 100644 --- a/Split/Common/Utils/Logger.swift +++ b/Split/Common/Utils/Logger.swift @@ -13,7 +13,6 @@ import Logging typealias Logger = Logging.Logger /// Split's implementation of DateProvider using Date+Utils extensions. -/// Declared here to ensure it's compiled as part of Split's sources when building with Xcode. struct SplitDateProvider: DateProvider { func nowMillis() -> Int64 { Date.nowMillis() From 5a412df43bb09399367dd9025819c2fbeda5faaa Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 23:06:50 -0300 Subject: [PATCH 08/18] Remove unnecessary rename --- Split/Api/DefaultSplitClient.swift | 12 ++++++------ Split/Api/LocalhostSplitClient.swift | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Split/Api/DefaultSplitClient.swift b/Split/Api/DefaultSplitClient.swift index 0dfb46999..625c06265 100644 --- a/Split/Api/DefaultSplitClient.swift +++ b/Split/Api/DefaultSplitClient.swift @@ -91,16 +91,16 @@ extension DefaultSplitClient { // MARK: Events Listeners with Medatadata @objc public func addEventListener(listener: SplitEventListener) { - if let listenerBlock = listener.onSdkReady { - registerEvent(.sdkReady, action: listenerBlock) + if let l = listener.onSdkReady { + registerEvent(.sdkReady, action: l) } - if let listenerBlock = listener.onSdkReadyFromCache { - registerEvent(.sdkReadyFromCache, action: listenerBlock) + if let l = listener.onSdkReadyFromCache { + registerEvent(.sdkReadyFromCache, action: l) } - if let listenerBlock = listener.onSdkUpdate { - registerEvent(.sdkUpdated, action: listenerBlock) + if let l = listener.onSdkUpdate { + registerEvent(.sdkUpdated, action: l) } } diff --git a/Split/Api/LocalhostSplitClient.swift b/Split/Api/LocalhostSplitClient.swift index 92e5012ef..094e4f2c8 100644 --- a/Split/Api/LocalhostSplitClient.swift +++ b/Split/Api/LocalhostSplitClient.swift @@ -145,16 +145,16 @@ public final class LocalhostSplitClient: NSObject, SplitClient { // MARK: Events Listeners with Medatadata @objc public func addEventListener(listener: SplitEventListener) { - if let listenerBlock = listener.onSdkReady { - registerEvent(.sdkReady, action: listenerBlock) + if let l = listener.onSdkReady { + registerEvent(.sdkReady, action: l) } - if let listenerBlock = listener.onSdkReadyFromCache { - registerEvent(.sdkReadyFromCache, action: listenerBlock) + if let l = listener.onSdkReadyFromCache { + registerEvent(.sdkReadyFromCache, action: l) } - if let listenerBlock = listener.onSdkUpdate { - registerEvent(.sdkUpdated, action: listenerBlock) + if let l = listener.onSdkUpdate { + registerEvent(.sdkUpdated, action: l) } } From 83f8ded3bf53a79c615ec25b9054b9bb259786a9 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 23:32:10 -0300 Subject: [PATCH 09/18] Expose Logging as product --- Package.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 6fed8c183..0e4ec0203 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,8 @@ let package = Package( name: "Split", platforms: [.iOS(.v9), .macOS(.v10_11), .watchOS(.v7), .tvOS(.v9)], products: [ - .library(name: "Split", targets: ["Split"]) + .library(name: "Split", targets: ["Split"]), + .library(name: "Logging", targets: ["Logging"]) ], targets: [ .target( From 1293b494603a9c3b6330fe173b6812d93c81d9d0 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Sat, 24 Jan 2026 23:53:57 -0300 Subject: [PATCH 10/18] SplitModules product --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 0e4ec0203..ecb6d1e61 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( platforms: [.iOS(.v9), .macOS(.v10_11), .watchOS(.v7), .tvOS(.v9)], products: [ .library(name: "Split", targets: ["Split"]), - .library(name: "Logging", targets: ["Logging"]) + .library(name: "SplitModules", targets: ["Logging"]) ], targets: [ .target( From 57f07911dfc00a853046c35ba5ba20509b227a2c Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Mon, 26 Jan 2026 11:56:24 -0300 Subject: [PATCH 11/18] WIP kaban --- Package.swift | 20 +- Sources/Logging/Logging.swift | 8 + Sources/Logging/README.md | 1 + Sources/Logging/Tests/LoggingTests.swift | 9 + Split.podspec | 4 +- Split.xcodeproj/project.pbxproj | 383 ++++++++++++++++++++++- Split/_KwiftDependencies.swift | 6 + 7 files changed, 418 insertions(+), 13 deletions(-) create mode 100644 Sources/Logging/Logging.swift create mode 100644 Sources/Logging/README.md create mode 100644 Sources/Logging/Tests/LoggingTests.swift create mode 100644 Split/_KwiftDependencies.swift diff --git a/Package.swift b/Package.swift index f175b80ea..8fe3fd598 100644 --- a/Package.swift +++ b/Package.swift @@ -7,16 +7,30 @@ let package = Package( platforms: [.iOS(.v9), .macOS(.v10_11), .watchOS(.v7), .tvOS(.v9)], products: [ .library(name: "Split", targets: ["Split"]) - ], + + .library(name: "SplitCommons", targets: ["Logging"]),], targets: [ .target( name: "Split", - path: "Split", + dependencies: ["Logging"], +path: "Split", exclude: [ "Common/Yaml/LICENSE", "Info.plist", "Split.h" ] - ) + ), + + .target( + name: "Logging", + dependencies: [], + exclude: ["Tests", "README.md"] + ), + .testTarget( + name: "LoggingTests", + dependencies: ["Logging"], + path: "Sources/Logging/Tests" + ), + // #INJECT_TARGET ] ) diff --git a/Sources/Logging/Logging.swift b/Sources/Logging/Logging.swift new file mode 100644 index 000000000..d25f965e4 --- /dev/null +++ b/Sources/Logging/Logging.swift @@ -0,0 +1,8 @@ +import Foundation + +public struct LoggingInternal { + public init() {} + public func action() { + print("Logging ready.") + } +} \ No newline at end of file diff --git a/Sources/Logging/README.md b/Sources/Logging/README.md new file mode 100644 index 000000000..b921bbe50 --- /dev/null +++ b/Sources/Logging/README.md @@ -0,0 +1 @@ +# Logging diff --git a/Sources/Logging/Tests/LoggingTests.swift b/Sources/Logging/Tests/LoggingTests.swift new file mode 100644 index 000000000..f5559f6ed --- /dev/null +++ b/Sources/Logging/Tests/LoggingTests.swift @@ -0,0 +1,9 @@ +import XCTest +@testable import Logging + +final class LoggingTests: XCTestCase { + func testExample() { + // Add your tests here + XCTAssertTrue(true) + } +} \ No newline at end of file diff --git a/Split.podspec b/Split.podspec index 3ba9bf6b8..7297d962b 100644 --- a/Split.podspec +++ b/Split.podspec @@ -16,7 +16,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, s s.swift_versions = ['4.0', '4.2', '5.0', '5.1', '5.2', '5.3'] s.resources = "Split/Storage/split_cache.xcdatamodeld" s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PROJECT_DIR)/Split/Common/Utils/JFBCrypt', 'SWIFT_INCLUDE_PATHS' => '${PROJECT_DIR}/Split/Common/Utils/JFBCrypt' } - s.source_files = 'Split/**/*.{swift}','Split/Common/Utils/JFBCrypt/*.{h,m}' - s.exclude_files = 'Split/Common/Utils/Lib/*' + s.source_files = 'Sources/**/*' + s.exclude_files = 'Sources/**/Tests/**' end diff --git a/Split.xcodeproj/project.pbxproj b/Split.xcodeproj/project.pbxproj index ee39216c0..abca797eb 100644 --- a/Split.xcodeproj/project.pbxproj +++ b/Split.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 2302B134A0BFE6B5626F07AD /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC9438DCA8FC60FEC194548 /* LoggingTests.swift */; }; 31AA2036872EEC62D9EDF4AB /* Endpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31AA22D3DA2B022F2E7F3231 /* Endpoint.swift */; }; 31AA21DE01A000A7C30630F2 /* SseClientTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31AA280A65C72BC92858422C /* SseClientTest.swift */; }; 31AA228978A886748090A790 /* HttpStreamResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31AA2744A2006D558FCBE8CE /* HttpStreamResponse.swift */; }; @@ -831,6 +832,8 @@ 5BF52DF72DE0B60700FEDAFE /* PrerequisitesMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */; }; 5BF52DF92DE4B8D400FEDAFE /* PrerequisitesMatcherTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF82DE4B8CA00FEDAFE /* PrerequisitesMatcherTest.swift */; }; 5BF52E032DE62F0500FEDAFE /* PrerequisitesMatcherMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */; }; + 6C68D45EEE2C3E49095B2608 /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47D728CC6DD6BE8801F7CA8D /* Logging.swift */; }; + 8265D23DD90A3945041F7846 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3310AD6DAA71B09C53FD06F4 /* Foundation.framework */; }; 9500D9922C56F9BA00383593 /* HostDomainFilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9912C56F9BA00383593 /* HostDomainFilterTests.swift */; }; 9500D9A92C59297400383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; 9500D9AA2C59382000383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; @@ -1547,6 +1550,7 @@ 95F7BC272C45C12700C5F2E4 /* TlsPinCheckerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F7BC262C45C12700C5F2E4 /* TlsPinCheckerMock.swift */; }; 95F7BC292C46A4C800C5F2E4 /* SecurityHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F7BC282C46A4C800C5F2E4 /* SecurityHelper.swift */; }; 95F8F06828170473009E09B1 /* multi_client_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 95F8F06728170473009E09B1 /* multi_client_test.json */; }; + C0ED3B006174CBDA66000BB0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3310AD6DAA71B09C53FD06F4 /* Foundation.framework */; }; C514F6B62BEA6F1F00C8DF78 /* HttpParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = C514F6B52BEA6F1F00C8DF78 /* HttpParameters.swift */; }; C526DE4C2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C526DE4B2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift */; }; C52C57292EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52C57282EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift */; }; @@ -1666,6 +1670,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 35353B9E8A9A3BA51D122AFE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; + proxyType = 1; + remoteGlobalIDString = CE3D219AC42E3E9CBC6E8D2B; + remoteInfo = Logging; + }; + 3B51FC238425C7FF12F8FF97 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; + proxyType = 1; + remoteGlobalIDString = CE3D219AC42E3E9CBC6E8D2B; + remoteInfo = Logging; + }; 592C6AAB211B6C99002D120C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; @@ -1716,6 +1734,7 @@ 31AA2B308C842042CD5D4ED3 /* RestClient+SplitChanges.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RestClient+SplitChanges.swift"; sourceTree = ""; }; 31AA2B33B325F1FD8A8C1776 /* HttpDataRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HttpDataRequest.swift; sourceTree = ""; }; 31AA2EAA5F782C4F108D7777 /* ServiceEndpoints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceEndpoints.swift; sourceTree = ""; }; + 3310AD6DAA71B09C53FD06F4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 3B6DEE5A20EA6A4E0067435E /* Split.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Split.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B6DEE5E20EA6A4E0067435E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3B6DEE7820EA6ADF0067435E /* EventDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventDTO.swift; sourceTree = ""; }; @@ -1804,6 +1823,7 @@ 3B6DEF0620EA6AE40067435E /* ConcurrentArrayQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConcurrentArrayQueue.swift; sourceTree = ""; }; 3B6DEF0920EA6AE40067435E /* DefaultFileStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultFileStorage.swift; sourceTree = ""; }; 3BBFF93220EFA2A0005F8C26 /* SplitEventActionTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplitEventActionTask.swift; sourceTree = ""; }; + 47D728CC6DD6BE8801F7CA8D /* Logging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = ""; }; 5903C496210A5E0900A754B0 /* SynchronizedList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SynchronizedList.swift; sourceTree = ""; }; 5905D4C02555F99D006DA3B1 /* GeneralInfoEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralInfoEntity.swift; sourceTree = ""; }; 5905D4C22555F99D006DA3B1 /* ImpressionEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImpressionEntity.swift; sourceTree = ""; }; @@ -2074,6 +2094,7 @@ 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcher.swift; sourceTree = ""; }; 5BF52DF82DE4B8CA00FEDAFE /* PrerequisitesMatcherTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcherTest.swift; sourceTree = ""; }; 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcherMock.swift; sourceTree = ""; }; + 78AFF5AE2FCD12D9D4917100 /* LoggingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LoggingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9500D9912C56F9BA00383593 /* HostDomainFilterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostDomainFilterTests.swift; sourceTree = ""; }; 9500D9A82C59297400383593 /* HostDomainFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostDomainFilter.swift; sourceTree = ""; }; 9500D9AC2C5A918300383593 /* split_cache_v5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = split_cache_v5.xcdatamodel; sourceTree = ""; }; @@ -2483,6 +2504,7 @@ 95F7BC262C45C12700C5F2E4 /* TlsPinCheckerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TlsPinCheckerMock.swift; sourceTree = ""; }; 95F7BC282C46A4C800C5F2E4 /* SecurityHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityHelper.swift; sourceTree = ""; }; 95F8F06728170473009E09B1 /* multi_client_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = multi_client_test.json; sourceTree = ""; }; + A1EC0DDCC4C5B8B13AB584FB /* Logging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Logging.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C514F6B52BEA6F1F00C8DF78 /* HttpParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HttpParameters.swift; sourceTree = ""; }; C526DE4B2D9B09EB0051DAB8 /* ImpressionsPropertiesE2ETest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImpressionsPropertiesE2ETest.swift; sourceTree = ""; }; C52C57282EEB41350064D049 /* EncryptionKeyValidationIntegrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptionKeyValidationIntegrationTest.swift; sourceTree = ""; }; @@ -2567,9 +2589,18 @@ C5E967562D38013000112DAC /* GeneralInfoStorageMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralInfoStorageMock.swift; sourceTree = ""; }; C5E9675E2D3849BE00112DAC /* RolloutDefinitionsCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolloutDefinitionsCache.swift; sourceTree = ""; }; C5E967612D395DAA00112DAC /* RolloutCacheManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolloutCacheManagerTest.swift; sourceTree = ""; }; + DDC9438DCA8FC60FEC194548 /* LoggingTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LoggingTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 166F98756B419A185AFCBBA3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C0ED3B006174CBDA66000BB0 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5620EA6A4E0067435E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2608,6 +2639,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A48D2E8293F47EF36C399431 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8265D23DD90A3945041F7846 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -2677,6 +2716,7 @@ 3B6DEE5B20EA6A4E0067435E /* Products */, 590DF9962125F6900082B94F /* Frameworks */, 5B3C18052ED76BAE0068D623 /* SplitTests copy-Info.plist */, + 8B111CC6F6949E959F8BAE82 /* Sources */, ); sourceTree = ""; }; @@ -2688,6 +2728,8 @@ 95825BA0271F004700A0CDAD /* Split_Split.bundle */, 95B02CA428D0BD790030EC8B /* SplitWatchOS.framework */, 5B3C18042ED76BAD0068D623 /* SplitTestsSwift6.xctest */, + A1EC0DDCC4C5B8B13AB584FB /* Logging.framework */, + 78AFF5AE2FCD12D9D4917100 /* LoggingTests.xctest */, ); name = Products; sourceTree = ""; @@ -3304,6 +3346,7 @@ 95B02E0928D130670030EC8B /* WatchKit.framework */, 954F9BBF2575A1AB00140B81 /* UIKit.framework */, 5946783722E1144400F94E58 /* Swifter.framework */, + B2F2ED01E7AEF469AA85A910 /* iOS */, ); name = Frameworks; sourceTree = ""; @@ -3754,6 +3797,15 @@ path = FallbackTreatmentsTests; sourceTree = ""; }; + 8B111CC6F6949E959F8BAE82 /* Sources */ = { + isa = PBXGroup; + children = ( + FC5ED3CB5B734CFCE8D24EB9 /* Logging */, + ); + name = Sources; + path = Sources; + sourceTree = ""; + }; 95118EE9281AC80400782F33 /* UserConsent */ = { isa = PBXGroup; children = ( @@ -4264,6 +4316,14 @@ path = CertPinning; sourceTree = ""; }; + B2F2ED01E7AEF469AA85A910 /* iOS */ = { + isa = PBXGroup; + children = ( + 3310AD6DAA71B09C53FD06F4 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; C539CAE42D947D2A0050C732 /* Validators */ = { isa = PBXGroup; children = ( @@ -4331,6 +4391,25 @@ path = RuleBasedSegments; sourceTree = ""; }; + C7B5F1ABBC6EB7AD87BB39EC /* Tests */ = { + isa = PBXGroup; + children = ( + DDC9438DCA8FC60FEC194548 /* LoggingTests.swift */, + ); + name = Tests; + path = Tests; + sourceTree = ""; + }; + FC5ED3CB5B734CFCE8D24EB9 /* Logging */ = { + isa = PBXGroup; + children = ( + C7B5F1ABBC6EB7AD87BB39EC /* Tests */, + 47D728CC6DD6BE8801F7CA8D /* Logging.swift */, + ); + name = Logging; + path = Logging; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -4342,6 +4421,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 89981F1DF50512CA261EB5F0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 954DAFA928DBCF74009E108F /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -4366,10 +4452,9 @@ buildRules = ( ); dependencies = ( + 1A420AAE3530459D6E22EDAB /* PBXTargetDependency */, ); name = Split; - packageProductDependencies = ( - ); productName = Split; productReference = 3B6DEE5A20EA6A4E0067435E /* Split.framework */; productType = "com.apple.product-type.framework"; @@ -4389,8 +4474,6 @@ 592C6AAC211B6C99002D120C /* PBXTargetDependency */, ); name = SplitTestsSwift5; - packageProductDependencies = ( - ); productName = SplitTests; productReference = 592C6AA5211B6C99002D120C /* SplitTestsSwift5.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -4410,8 +4493,6 @@ 5B3C16352ED76BAD0068D623 /* PBXTargetDependency */, ); name = SplitTestsSwift6; - packageProductDependencies = ( - ); productName = SplitTests; productReference = 5B3C18042ED76BAD0068D623 /* SplitTestsSwift6.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -4451,6 +4532,42 @@ productReference = 95B02CA428D0BD790030EC8B /* SplitWatchOS.framework */; productType = "com.apple.product-type.framework"; }; + CE3D219AC42E3E9CBC6E8D2B /* Logging */ = { + isa = PBXNativeTarget; + buildConfigurationList = ED69C1CC20B893177298AF56 /* Build configuration list for PBXNativeTarget "Logging" */; + buildPhases = ( + 89981F1DF50512CA261EB5F0 /* Headers */, + 1F4ABFFF91376225DFBAFA5A /* Sources */, + A48D2E8293F47EF36C399431 /* Frameworks */, + 8224E32C5E4322A5C6156BC4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Logging; + productName = Logging; + productReference = A1EC0DDCC4C5B8B13AB584FB /* Logging.framework */; + productType = "com.apple.product-type.framework"; + }; + FDC0744272FCA047AB3E733A /* LoggingTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 57BB370AA2DDCDB349EB11A8 /* Build configuration list for PBXNativeTarget "LoggingTests" */; + buildPhases = ( + 155AAD5319839498831ED6CB /* Sources */, + 166F98756B419A185AFCBBA3 /* Frameworks */, + 1F86C4B0E41E1F7244BF3AE4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 0AC860035C528C4D12E3623D /* PBXTargetDependency */, + ); + name = LoggingTests; + productName = LoggingTests; + productReference = 78AFF5AE2FCD12D9D4917100 /* LoggingTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -4488,8 +4605,6 @@ Base, ); mainGroup = 3B6DEE5020EA6A4D0067435E; - packageReferences = ( - ); productRefGroup = 3B6DEE5B20EA6A4E0067435E /* Products */; projectDirPath = ""; projectRoot = ""; @@ -4499,11 +4614,20 @@ 5B3C16342ED76BAD0068D623 /* SplitTestsSwift6 */, 95825B9F271F004700A0CDAD /* Split_Split */, 95B02CA328D0BD790030EC8B /* SplitWatchOS */, + CE3D219AC42E3E9CBC6E8D2B /* Logging */, + FDC0744272FCA047AB3E733A /* LoggingTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 1F86C4B0E41E1F7244BF3AE4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5820EA6A4E0067435E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4703,6 +4827,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 8224E32C5E4322A5C6156BC4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 95825B9E271F004700A0CDAD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4743,6 +4874,22 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 155AAD5319839498831ED6CB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2302B134A0BFE6B5626F07AD /* LoggingTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1F4ABFFF91376225DFBAFA5A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6C68D45EEE2C3E49095B2608 /* Logging.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B6DEE5520EA6A4E0067435E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -6251,6 +6398,18 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 0AC860035C528C4D12E3623D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Logging; + target = CE3D219AC42E3E9CBC6E8D2B /* Logging */; + targetProxy = 35353B9E8A9A3BA51D122AFE /* PBXContainerItemProxy */; + }; + 1A420AAE3530459D6E22EDAB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Logging; + target = CE3D219AC42E3E9CBC6E8D2B /* Logging */; + targetProxy = 3B51FC238425C7FF12F8FF97 /* PBXContainerItemProxy */; + }; 592C6AAC211B6C99002D120C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3B6DEE5920EA6A4E0067435E /* Split */; @@ -6264,6 +6423,72 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 011668E83B9D8F89643DBF77 /* Debug-Swift6 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = "Debug-Swift6"; + }; + 0268BCB9F51644101827EFB5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 0B2CA9D58777E78CFBC8AA0B /* Debug-Swift5 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = "Debug-Swift5"; + }; 3B6DEE6020EA6A4E0067435E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6490,6 +6715,34 @@ }; name = Release; }; + 56983EB585A45223C11F2002 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 592C6AAD211B6C99002D120C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6600,6 +6853,33 @@ }; name = Release; }; + 86376156C3F37979F4950666 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; 95825BA3271F004800A0CDAD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6730,6 +7010,25 @@ }; name = Release; }; + A1EFF1E396DE776C46CDFF70 /* Debug-Swift6 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = "Debug-Swift6"; + }; C59D18C82EDA131D002C86FB /* Debug-Swift5 */ = { isa = XCBuildConfiguration; buildSettings = { @@ -7211,6 +7510,52 @@ }; name = "Debug-Swift6"; }; + DD35114C3228CD74548A7517 /* Debug-Swift5 */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Logging"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = "Debug-Swift5"; + }; + F600AD2D0D1396247B6BC357 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).LoggingTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TEST_HOST = ""; + }; + name = Debug; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -7236,6 +7581,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 57BB370AA2DDCDB349EB11A8 /* Build configuration list for PBXNativeTarget "LoggingTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0268BCB9F51644101827EFB5 /* Release */, + F600AD2D0D1396247B6BC357 /* Debug */, + 0B2CA9D58777E78CFBC8AA0B /* Debug-Swift5 */, + A1EFF1E396DE776C46CDFF70 /* Debug-Swift6 */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 592C6AAF211B6C99002D120C /* Build configuration list for PBXNativeTarget "SplitTestsSwift5" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -7280,6 +7636,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + ED69C1CC20B893177298AF56 /* Build configuration list for PBXNativeTarget "Logging" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 56983EB585A45223C11F2002 /* Release */, + 86376156C3F37979F4950666 /* Debug */, + DD35114C3228CD74548A7517 /* Debug-Swift5 */, + 011668E83B9D8F89643DBF77 /* Debug-Swift6 */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCVersionGroup section */ diff --git a/Split/_KwiftDependencies.swift b/Split/_KwiftDependencies.swift new file mode 100644 index 000000000..4803cf161 --- /dev/null +++ b/Split/_KwiftDependencies.swift @@ -0,0 +1,6 @@ +/// Auto-generated by Kwift to verify dependency wiring at compile time. +private enum _KwiftDependencies { + static func link() { + _ = LoggingInternal() + } +} \ No newline at end of file From e41ac656c8b9a874f5cf6ce86f4bf4de0fa84fae Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Mon, 26 Jan 2026 12:12:04 -0300 Subject: [PATCH 12/18] Update README --- Sources/Logging/README.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Sources/Logging/README.md b/Sources/Logging/README.md index bef40b4ca..300fa26de 100644 --- a/Sources/Logging/README.md +++ b/Sources/Logging/README.md @@ -10,18 +10,7 @@ ## Usage -### 1) Add as a Swift Package dependency - -In your `Package.swift`: - -```swift -.target( - name: "YourTarget", - dependencies: ["Logging"] -) -``` - -### 2) Configure required dependencies +### 1) Configure required dependencies This module intentionally does **not** implement “real time” by default. You must provide a `DateProvider` from the host app/module (e.g. using `Foundation.Date`, your own time utils, etc). @@ -44,7 +33,7 @@ Logger.shared.dateProvider = AppDateProvider() Logger.shared.level = .info ``` -### 3) Log +### 2) Log ```swift import Logging From 1c3e53134909bd01af0fa249976e4f38b9a6e4b9 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Mon, 26 Jan 2026 12:29:14 -0300 Subject: [PATCH 13/18] Update Split podspec --- Split.podspec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Split.podspec b/Split.podspec index 555344854..7b29503dd 100644 --- a/Split.podspec +++ b/Split.podspec @@ -19,9 +19,5 @@ This SDK is designed to work with Split, the platform for controlled rollouts, s s.source_files = 'Sources/**/*' s.exclude_files = 'Sources/**/Tests/**' - s.subspec 'Logging' do |ss| - ss.source_files = 'Sources/Logging/**/*' - end - # #INJECT_SUBSPEC end From f3d5f84cd52c7f08dcec1423823692e6ceb1809d Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Fri, 6 Feb 2026 14:19:52 -0300 Subject: [PATCH 14/18] Improve comments --- Sources/Logging/LogLevel.swift | 2 -- Sources/Logging/LogPrinter.swift | 2 -- Sources/Logging/Logger.swift | 2 -- 3 files changed, 6 deletions(-) diff --git a/Sources/Logging/LogLevel.swift b/Sources/Logging/LogLevel.swift index a010080f2..9c93c2143 100644 --- a/Sources/Logging/LogLevel.swift +++ b/Sources/Logging/LogLevel.swift @@ -2,8 +2,6 @@ // LogLevel.swift // Logging // -// Created by Split SDK Team -// import Foundation diff --git a/Sources/Logging/LogPrinter.swift b/Sources/Logging/LogPrinter.swift index 611b86aa9..daf4db2d3 100644 --- a/Sources/Logging/LogPrinter.swift +++ b/Sources/Logging/LogPrinter.swift @@ -2,8 +2,6 @@ // LogPrinter.swift // Logging // -// Created by Split SDK Team -// import Foundation diff --git a/Sources/Logging/Logger.swift b/Sources/Logging/Logger.swift index 8293d0594..b6488a155 100644 --- a/Sources/Logging/Logger.swift +++ b/Sources/Logging/Logger.swift @@ -2,8 +2,6 @@ // Logger.swift // Logging // -// Created by Split SDK Team -// import Foundation From 75dc3a07a42cc6502739d8f537c8494725bacf09 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Fri, 6 Feb 2026 14:55:49 -0300 Subject: [PATCH 15/18] Add Logging dependency to watchOs --- Split.xcodeproj/project.pbxproj | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Split.xcodeproj/project.pbxproj b/Split.xcodeproj/project.pbxproj index 0c2590275..b4fdd9685 100644 --- a/Split.xcodeproj/project.pbxproj +++ b/Split.xcodeproj/project.pbxproj @@ -1714,6 +1714,13 @@ remoteGlobalIDString = 557D062442413680641861B3; remoteInfo = Logging; }; + 95B02CAB28D0BD7A0030EC8C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 557D062442413680641861B3; + remoteInfo = Logging; + }; ED0C4156420B8E843DF9A23B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3B6DEE5120EA6A4D0067435E /* Project object */; @@ -4649,6 +4656,7 @@ buildRules = ( ); dependencies = ( + 95B02CAC28D0BD7A0030EC8D /* PBXTargetDependency */, ); name = SplitWatchOS; productName = SplitTvOS; @@ -6543,12 +6551,19 @@ target = 557D062442413680641861B3 /* Logging */; targetProxy = ED0C4156420B8E843DF9A23B /* PBXContainerItemProxy */; }; + 95B02CAC28D0BD7A0030EC8D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Logging; + target = 557D062442413680641861B3 /* Logging */; + targetProxy = 95B02CAB28D0BD7A0030EC8C /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 1E6BFABC4C3C513B159FB9B9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_OBJC_WEAK = NO; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -6567,16 +6582,19 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; + SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,4"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Release; }; 3809C6CC6901B64FF7C40F6F /* Debug-Swift6 */ = { isa = XCBuildConfiguration; buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_OBJC_WEAK = NO; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -6595,7 +6613,9 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; + SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,4"; + WATCHOS_DEPLOYMENT_TARGET = 7.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -6604,6 +6624,7 @@ 3961E0B6BAE2C41629EBA80C /* Debug-Swift5 */ = { isa = XCBuildConfiguration; buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_OBJC_WEAK = NO; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -6622,9 +6643,11 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; + SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,4"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = "Debug-Swift5"; }; @@ -6857,6 +6880,7 @@ 3FAFFF1BCBD47F87A6574701 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; CLANG_ENABLE_OBJC_WEAK = NO; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -6875,9 +6899,11 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; + SUPPORTED_PLATFORMS = "watchsimulator watchos macosx iphonesimulator iphoneos appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = "1,2,4"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Debug; }; From 342afb52a7b4c899af6d85a34d67b07e20749ec6 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Fri, 6 Feb 2026 15:44:34 -0300 Subject: [PATCH 16/18] Increase test coverage --- Split/_KwiftDependencies.swift | 9 -- SplitTests/Init/ConfigTest.swift | 133 +++++++++++++++++++- SplitTests/Integration/Api/LoggerTest.swift | 24 ++++ 3 files changed, 156 insertions(+), 10 deletions(-) delete mode 100644 Split/_KwiftDependencies.swift diff --git a/Split/_KwiftDependencies.swift b/Split/_KwiftDependencies.swift deleted file mode 100644 index 020d7bc2e..000000000 --- a/Split/_KwiftDependencies.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Logging - -/// Auto-generated by Kwift to verify dependency wiring at compile time. -private enum _KwiftDependencies { - static func link() { - // Ensure Logging module is linked - _ = Logger.shared - } -} \ No newline at end of file diff --git a/SplitTests/Init/ConfigTest.swift b/SplitTests/Init/ConfigTest.swift index 813835ed1..82fb74611 100644 --- a/SplitTests/Init/ConfigTest.swift +++ b/SplitTests/Init/ConfigTest.swift @@ -14,7 +14,138 @@ import XCTest class ConfigTest: XCTestCase { var config = SplitClientConfig() - // MARK: ImpressionsMode + override func setUp() { + super.setUp() + config = SplitClientConfig() + // Reset logger level to default (.none) before each test + Logger.shared.level = SplitLogLevel.none.toLogLevel() + } + + func testIsDebugModeEnabledGetterReturnsTrueWhenDebug() { + Logger.shared.level = SplitLogLevel.debug.toLogLevel() + + XCTAssertTrue(config.isDebugModeEnabled) + } + + func testIsDebugModeEnabledGetterReturnsFalseWhenNotDebug() { + Logger.shared.level = SplitLogLevel.verbose.toLogLevel() + + XCTAssertFalse(config.isDebugModeEnabled) + } + + func testIsDebugModeEnabledGetterReturnsFalseWhenNone() { + Logger.shared.level = SplitLogLevel.none.toLogLevel() + + XCTAssertFalse(config.isDebugModeEnabled) + } + + func testIsDebugModeEnabledSetterSetsDebugWhenLevelIsNone() { + // Level starts at .none + config.isDebugModeEnabled = true + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .debug) + } + + func testIsDebugModeEnabledSetterKeepsNoneWhenSetToFalse() { + config.isDebugModeEnabled = false + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .none) + } + + func testIsDebugModeEnabledSetterDoesNotChangeWhenLevelIsNotNone() { + Logger.shared.level = SplitLogLevel.warning.toLogLevel() + + config.isDebugModeEnabled = true + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .warning) + } + + func testIsVerboseModeEnabledGetterReturnsTrueWhenVerbose() { + Logger.shared.level = SplitLogLevel.verbose.toLogLevel() + + XCTAssertTrue(config.isVerboseModeEnabled) + } + + func testIsVerboseModeEnabledGetterReturnsFalseWhenNotVerbose() { + Logger.shared.level = SplitLogLevel.debug.toLogLevel() + + XCTAssertFalse(config.isVerboseModeEnabled) + } + + func testIsVerboseModeEnabledGetterReturnsFalseWhenNone() { + Logger.shared.level = SplitLogLevel.none.toLogLevel() + + XCTAssertFalse(config.isVerboseModeEnabled) + } + + func testIsVerboseModeEnabledSetterSetsVerboseWhenLevelIsNone() { + config.isVerboseModeEnabled = true + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .verbose) + } + + func testIsVerboseModeEnabledSetterKeepsNoneWhenSetToFalse() { + config.isVerboseModeEnabled = false + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .none) + } + + func testIsVerboseModeEnabledSetterDoesNotChangeWhenLevelIsNotNone() { + Logger.shared.level = SplitLogLevel.error.toLogLevel() + + config.isVerboseModeEnabled = true + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .error) + } + + func testLogLevelGetterReturnsCurrentLevel() { + let levels: [SplitLogLevel] = [.verbose, .debug, .info, .warning, .error, .none] + + for level in levels { + Logger.shared.level = level.toLogLevel() + + XCTAssertEqual(config.logLevel, level, + "Expected logLevel to return \(level)") + } + } + + func testSetLogLevelWithValidString() { + config.set(logLevel: "VERBOSE") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .verbose) + + config.set(logLevel: "DEBUG") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .debug) + + config.set(logLevel: "INFO") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .info) + + config.set(logLevel: "WARNING") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .warning) + + config.set(logLevel: "ERROR") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .error) + + config.set(logLevel: "NONE") + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .none) + } + + func testSetLogLevelWithInvalidStringDefaultsToNone() { + Logger.shared.level = SplitLogLevel.debug.toLogLevel() + + config.set(logLevel: "INVALID") + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .none) + } + + func testSetLogLevelWithEmptyStringDefaultsToNone() { + Logger.shared.level = SplitLogLevel.verbose.toLogLevel() + + config.set(logLevel: "") + + XCTAssertEqual(SplitLogLevel.from(Logger.shared.level), .none) + } + + // MARK: - ImpressionsMode func testImpressionsModeEmpty() { config.impressionsMode = "" diff --git a/SplitTests/Integration/Api/LoggerTest.swift b/SplitTests/Integration/Api/LoggerTest.swift index 1a4366234..f26e380db 100644 --- a/SplitTests/Integration/Api/LoggerTest.swift +++ b/SplitTests/Integration/Api/LoggerTest.swift @@ -95,6 +95,30 @@ class LoggerTest : XCTestCase { XCTAssertTrue(isLogged(level: .error)) } + func testToLogLevelVerbose() { + XCTAssertEqual(SplitLogLevel.verbose.toLogLevel(), LogLevel.verbose) + } + + func testToLogLevelDebug() { + XCTAssertEqual(SplitLogLevel.debug.toLogLevel(), LogLevel.debug) + } + + func testToLogLevelInfo() { + XCTAssertEqual(SplitLogLevel.info.toLogLevel(), LogLevel.info) + } + + func testToLogLevelWarning() { + XCTAssertEqual(SplitLogLevel.warning.toLogLevel(), LogLevel.warning) + } + + func testToLogLevelError() { + XCTAssertEqual(SplitLogLevel.error.toLogLevel(), LogLevel.error) + } + + func testToLogLevelNone() { + XCTAssertEqual(SplitLogLevel.none.toLogLevel(), LogLevel.none) + } + private func isLogged(level: LogLevel) -> Bool { return printer.logs.filter { $0.contains("\(level.rawValue)") }.count > 0 } From 9b7b7eba6c9c0f9d2af191cd84f4d78e325856e4 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Fri, 6 Feb 2026 15:50:53 -0300 Subject: [PATCH 17/18] Add Logging tests to sonar report --- .github/workflows/sonar.yml | 4 ++-- SplitiOSFull.xctestplan | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index f5b7c052a..ed13b8327 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -149,7 +149,7 @@ jobs: -Dsonar.objc.file.suffixes=- -Dsonar.coverageReportPaths=sonarqube-generic-coverage.xml -Dsonar.verbose=true - -Dsonar.sources=Split + -Dsonar.sources=Split,Sources -Dsonar.exclusions=**/Tests/**,**/*.generated.swift -Dsonar.coverage.exclusions=**/Tests/**,**/*.generated.swift -Dsonar.qualitygate.wait=true @@ -179,7 +179,7 @@ jobs: -Dsonar.objc.file.suffixes=- -Dsonar.coverageReportPaths=sonarqube-generic-coverage.xml -Dsonar.verbose=true - -Dsonar.sources=Split + -Dsonar.sources=Split,Sources -Dsonar.exclusions=**/Tests/**,**/*.generated.swift -Dsonar.coverage.exclusions=**/Tests/**,**/*.generated.swift -Dsonar.qualitygate.wait=true diff --git a/SplitiOSFull.xctestplan b/SplitiOSFull.xctestplan index ddb408e9d..03ba6994a 100644 --- a/SplitiOSFull.xctestplan +++ b/SplitiOSFull.xctestplan @@ -48,6 +48,13 @@ "identifier" : "592C6AA4211B6C99002D120C", "name" : "SplitTestsSwift5" } + }, + { + "target" : { + "containerPath" : "container:Split.xcodeproj", + "identifier" : "8000B2F11F535D99847B28BE", + "name" : "LoggingTests" + } } ], "version" : 1 From 5d9335ed4597bf271671a86fb4d7079bae9f59ed Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Tue, 10 Feb 2026 12:42:09 -0300 Subject: [PATCH 18/18] Default date provider --- Sources/Logging/DateProvider.swift | 19 ++++++--- Sources/Logging/Logger.swift | 2 +- Sources/Logging/README.md | 21 +++------ Sources/Logging/Tests/LoggingTests.swift | 4 +- Split/Api/SplitClientConfig.swift | 7 --- Split/Common/Utils/Logger.swift | 47 --------------------- SplitTests/Integration/Api/LoggerTest.swift | 4 +- 7 files changed, 22 insertions(+), 82 deletions(-) diff --git a/Sources/Logging/DateProvider.swift b/Sources/Logging/DateProvider.swift index 729c8eda7..f52d466d3 100644 --- a/Sources/Logging/DateProvider.swift +++ b/Sources/Logging/DateProvider.swift @@ -16,16 +16,21 @@ public protocol DateProvider { func nowLabel() -> String } -/// Placeholder implementation that returns hardcoded values -/// This should be replaced by a real implementation from the consuming module -public struct PlaceholderDateProvider: DateProvider { +/// Default implementation that uses Foundation's Date +public struct DefaultDateProvider: DateProvider { public init() {} - + + private static let formatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = "dd-MM-yyyy HH:mm:ss.SSS" + return formatter + }() + public func nowMillis() -> Int64 { - return 0 + return Int64(Date().timeIntervalSince1970 * 1000) } - + public func nowLabel() -> String { - return "00-00-0000 00:00:00.000" + return Self.formatter.string(from: Date()) } } diff --git a/Sources/Logging/Logger.swift b/Sources/Logging/Logger.swift index b6488a155..4f9ad7790 100644 --- a/Sources/Logging/Logger.swift +++ b/Sources/Logging/Logger.swift @@ -8,7 +8,7 @@ import Foundation /// Main logger class for the Logging module public class Logger: @unchecked Sendable { public var printer: LogPrinter = DefaultLogPrinter() - public var dateProvider: DateProvider = PlaceholderDateProvider() + public var dateProvider: DateProvider = DefaultDateProvider() private let tag: String = "SplitSDK" public var level: LogLevel = .none diff --git a/Sources/Logging/README.md b/Sources/Logging/README.md index 300fa26de..2a7d698e6 100644 --- a/Sources/Logging/README.md +++ b/Sources/Logging/README.md @@ -6,30 +6,19 @@ - `LogLevel`: logging level enum - `LogPrinter`: output interface (default prints to stdout) - `TimeChecker`: helper to measure and log time intervals -- `DateProvider`: host-provided timestamp + label formatting (keeps this module independent from your app’s time utilities) +- `DateProvider`: timestamp + label formatting (ships with a `DefaultDateProvider` backed by `Foundation.Date`) ## Usage -### 1) Configure required dependencies +### 1) Configure (optional) -This module intentionally does **not** implement “real time” by default. You must provide a `DateProvider` from the host app/module (e.g. using `Foundation.Date`, your own time utils, etc). - -Example: +The module ships with a `DefaultDateProvider` that uses `Foundation.Date`, so it works out of the box. You can still supply a custom `DateProvider` if you need different formatting or a custom clock: ```swift import Logging -import Foundation - -struct AppDateProvider: DateProvider { - func nowMillis() -> Int64 { Int64(Date().timeIntervalSince1970 * 1000) } - func nowLabel() -> String { - let formatter = DateFormatter() - formatter.dateFormat = "dd-MM-yyyy HH:mm:ss.SSS" - return formatter.string(from: Date()) - } -} -Logger.shared.dateProvider = AppDateProvider() +// Optional: override the default provider +Logger.shared.dateProvider = MyCustomDateProvider() Logger.shared.level = .info ``` diff --git a/Sources/Logging/Tests/LoggingTests.swift b/Sources/Logging/Tests/LoggingTests.swift index e73f85b53..b41c23a4c 100644 --- a/Sources/Logging/Tests/LoggingTests.swift +++ b/Sources/Logging/Tests/LoggingTests.swift @@ -18,7 +18,7 @@ class LoggingTests : XCTestCase { override func setUp() { printer.clear() Logger.shared.printer = printer - Logger.shared.dateProvider = PlaceholderDateProvider() + Logger.shared.dateProvider = DefaultDateProvider() } func testNone() { @@ -107,7 +107,7 @@ class LoggingTests : XCTestCase { override func tearDown() { Logger.shared.printer = DefaultLogPrinter() - Logger.shared.dateProvider = PlaceholderDateProvider() + Logger.shared.dateProvider = DefaultDateProvider() printer.clear() } } diff --git a/Split/Api/SplitClientConfig.swift b/Split/Api/SplitClientConfig.swift index e13704b15..d6dc349a4 100644 --- a/Split/Api/SplitClientConfig.swift +++ b/Split/Api/SplitClientConfig.swift @@ -126,11 +126,9 @@ public class SplitClientConfig: NSObject { @available(*, deprecated, message: "Use logLevel instead") @objc public var isDebugModeEnabled: Bool { get { - Logger.ensureInitialized() return SplitLogLevel.from(Logger.shared.level) == .debug } set { - Logger.ensureInitialized() if Logger.shared.level == .none { Logger.shared.level = newValue ? SplitLogLevel.debug.toLogLevel() : .none } @@ -144,11 +142,9 @@ public class SplitClientConfig: NSObject { @available(*, deprecated, message: "Use logLevel instead") @objc public var isVerboseModeEnabled: Bool { get { - Logger.ensureInitialized() return SplitLogLevel.from(Logger.shared.level) == .verbose } set { - Logger.ensureInitialized() if Logger.shared.level == .none { Logger.shared.level = newValue ? SplitLogLevel.verbose.toLogLevel() : .none } @@ -159,17 +155,14 @@ public class SplitClientConfig: NSObject { /// Swift only method public var logLevel: SplitLogLevel { get { - Logger.ensureInitialized() return SplitLogLevel.from(Logger.shared.level) } set { - Logger.ensureInitialized() Logger.shared.level = newValue.toLogLevel() } } @objc public func set(logLevel: String) { - Logger.ensureInitialized() Logger.shared.level = (SplitLogLevel(rawValue: logLevel) ?? .none).toLogLevel() } diff --git a/Split/Common/Utils/Logger.swift b/Split/Common/Utils/Logger.swift index 984b7e916..a964763ca 100644 --- a/Split/Common/Utils/Logger.swift +++ b/Split/Common/Utils/Logger.swift @@ -12,57 +12,10 @@ import Logging // This allows existing Split code to continue using Logger.* without changes typealias Logger = Logging.Logger -/// Split's implementation of DateProvider using Date+Utils extensions. -struct SplitDateProvider: DateProvider { - func nowMillis() -> Int64 { - Date.nowMillis() - } - - func nowLabel() -> String { - Date.nowLabel() - } -} - -// Initialize Logger with Split's DateProvider on first access -private let loggerInitializer: Void = { - Logger.shared.dateProvider = SplitDateProvider() -}() - -// Ensure logger is initialized when Split module loads -extension Logger { - static func ensureInitialized() { - _ = loggerInitializer - } -} - // Use Logging's TimeChecker implementation. -// We keep these overloads to preserve Split's call sites AND to ensure the DateProvider is injected first. typealias TimeChecker = Logging.TimeChecker -extension Logging.TimeChecker { - static func start() { - Logger.ensureInitialized() - Self.start(dateProvider: nil) - } - - static func logInterval(_ msg: String) { - Logger.ensureInitialized() - Self.logInterval(msg, dateProvider: nil) - } - - static func logTime(_ msg: String) { - Logger.ensureInitialized() - Self.logTime(msg, dateProvider: nil) - } - - static func logInterval(_ msg: String, startTime: Int64) { - Logger.ensureInitialized() - Self.logInterval(msg, startTime: startTime, dateProvider: nil) - } -} - // LogPrinter and DefaultLogPrinter are now in the Logging module // Re-export for backward compatibility typealias LogPrinter = Logging.LogPrinter typealias DefaultLogPrinter = Logging.DefaultLogPrinter - diff --git a/SplitTests/Integration/Api/LoggerTest.swift b/SplitTests/Integration/Api/LoggerTest.swift index f26e380db..53e7ae682 100644 --- a/SplitTests/Integration/Api/LoggerTest.swift +++ b/SplitTests/Integration/Api/LoggerTest.swift @@ -20,7 +20,7 @@ class LoggerTest : XCTestCase { override func setUp() { printer.clear() Logger.shared.printer = printer - Logger.shared.dateProvider = SplitDateProvider() + Logger.shared.dateProvider = DefaultDateProvider() } func testNone() { @@ -133,7 +133,7 @@ class LoggerTest : XCTestCase { override func tearDown() { Logger.shared.printer = DefaultLogPrinter() - Logger.shared.dateProvider = SplitDateProvider() + Logger.shared.dateProvider = DefaultDateProvider() printer.clear() } }