diff --git a/GoodPersistence-Sample/GoodPersistence-Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/GoodPersistence-Sample/GoodPersistence-Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e9a6b79..9d9fa4f 100644 --- a/GoodPersistence-Sample/GoodPersistence-Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/GoodPersistence-Sample/GoodPersistence-Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -9,6 +9,15 @@ "version" : "1.8.1" } }, + { + "identity" : "goodlogger", + "kind" : "remoteSourceControl", + "location" : "https://github.com/GoodRequest/GoodLogger.git", + "state" : { + "revision" : "7e0a11ffa920889c8d289c1dca60d6b0c94b0ae9", + "version" : "1.0.0" + } + }, { "identity" : "keychainaccess", "kind" : "remoteSourceControl", diff --git a/GoodPersistence-Sample/GoodPersistence-Sample/Application/AppDelegate.swift b/GoodPersistence-Sample/GoodPersistence-Sample/Application/AppDelegate.swift index 0fa2c74..0a7de46 100644 --- a/GoodPersistence-Sample/GoodPersistence-Sample/Application/AppDelegate.swift +++ b/GoodPersistence-Sample/GoodPersistence-Sample/Application/AppDelegate.swift @@ -7,6 +7,7 @@ import UIKit import GoodPersistence +import GoodLogger @main class AppDelegate: UIResponder, UIApplicationDelegate { diff --git a/Package.resolved b/Package.resolved index e9a6b79..9d9fa4f 100644 --- a/Package.resolved +++ b/Package.resolved @@ -9,6 +9,15 @@ "version" : "1.8.1" } }, + { + "identity" : "goodlogger", + "kind" : "remoteSourceControl", + "location" : "https://github.com/GoodRequest/GoodLogger.git", + "state" : { + "revision" : "7e0a11ffa920889c8d289c1dca60d6b0c94b0ae9", + "version" : "1.0.0" + } + }, { "identity" : "keychainaccess", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 37a0dfe..ed2b9a9 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,8 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. .package(url: "https://github.com/CombineCommunity/CombineExt.git", from: "1.0.0"), - .package(url: "https://github.com/kishikawakatsumi/KeychainAccess.git", from: "4.2.2") + .package(url: "https://github.com/kishikawakatsumi/KeychainAccess.git", from: "4.2.2"), + .package(url: "https://github.com/GoodRequest/GoodLogger.git", from: "1.0.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -26,7 +27,8 @@ let package = Package( name: "GoodPersistence", dependencies: [ .product(name: "CombineExt", package: "CombineExt"), - .product(name: "KeychainAccess", package: "KeychainAccess") + .product(name: "KeychainAccess", package: "KeychainAccess"), + .product(name: "GoodLogger", package: "GoodLogger") ], path: "./Sources", resources: [.copy("PrivacyInfo.xcprivacy")] diff --git a/Sources/GoodPersistence/LoggingMonitor/LoggingPersistenceMonitor.swift b/Sources/GoodPersistence/LoggingMonitor/LoggingPersistenceMonitor.swift index fb3e5da..5b4d9a0 100644 --- a/Sources/GoodPersistence/LoggingMonitor/LoggingPersistenceMonitor.swift +++ b/Sources/GoodPersistence/LoggingMonitor/LoggingPersistenceMonitor.swift @@ -5,21 +5,22 @@ // import Foundation +import GoodLogger public final class LoggingPersistenceMonitor: PersistenceMonitor { - private var logger: (any PersistanceLogger)? + private var logger: (any GoodLogger)? - public init(logger: (any PersistanceLogger)?) { + public init(logger: (any GoodLogger)?) { self.logger = logger } public func didReceive(_ monitor: any PersistenceMonitor, error: any Error) { - logger?.log(level: .error, message: error.localizedDescription) + logger?.log(level: .error, message: error.localizedDescription, privacy: .auto) } public func didReceive(_ monitor: any PersistenceMonitor, message: String) { - logger?.log(level: .info, message: message) + logger?.log(level: .info, message: message, privacy: .auto) } } diff --git a/Sources/GoodPersistence/LoggingMonitor/OSLogger.swift b/Sources/GoodPersistence/LoggingMonitor/OSLogger.swift deleted file mode 100644 index dc35058..0000000 --- a/Sources/GoodPersistence/LoggingMonitor/OSLogger.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// OSLogLogger.swift -// -// Created by Matus Klasovity on 30/01/2024. -// - -import Foundation -import OSLog - -@available(iOS 14, *) -public final class OSLogLogger: PersistanceLogger { - - private let logger = Logger(subsystem: "OSLogSessionLogger", category: "Networking") - - public init() {} - - public func log(level: OSLogType, message: String) { - logger.log(level: level, "\(message)") - } - -} diff --git a/Sources/GoodPersistence/LoggingMonitor/PersistenceLogger.swift b/Sources/GoodPersistence/LoggingMonitor/PersistenceLogger.swift deleted file mode 100644 index 108f8f9..0000000 --- a/Sources/GoodPersistence/LoggingMonitor/PersistenceLogger.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// PersistenceLogger.swift -// -// Created by Andrej Jasso on 12/04/2024. -// - -import Foundation -import OSLog - -public protocol PersistanceLogger { - - func log(level: OSLogType, message: String) - -} diff --git a/Sources/GoodPersistence/LoggingMonitor/PrintLogger.swift b/Sources/GoodPersistence/LoggingMonitor/PrintLogger.swift deleted file mode 100644 index 902fed1..0000000 --- a/Sources/GoodPersistence/LoggingMonitor/PrintLogger.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// PrintLogger.swift -// -// Created by Matus Klasovity on 30/01/2024. -// - -import Foundation -import OSLog - -public final class PrintLogger: PersistanceLogger { - - public init() {} - - public func log(level: OSLogType, message: String) { - print(message) - } - -}