From bb77d179975a8647fbef8b777b4100dad4d47c1e Mon Sep 17 00:00:00 2001 From: Leo Dion Date: Mon, 21 Oct 2024 17:36:03 -0400 Subject: [PATCH] fixing felinepine logging --- Package.swift | 19 +++--- Sources/FelinePineLogging/Feline.swift | 2 +- Sources/FelinePineLogging/Loggable.swift | 53 ++++++++++++---- ...oggingSystem+LoggingSystemRepository.swift | 2 +- Sources/FelinePineLogging/NSLocking.swift | 2 +- Sources/FelinePineLogging/Pine.swift | 62 +++++-------------- 6 files changed, 68 insertions(+), 72 deletions(-) diff --git a/Package.swift b/Package.swift index a0d9715..e9a9e96 100644 --- a/Package.swift +++ b/Package.swift @@ -6,19 +6,23 @@ import PackageDescription let package = Package( name: "FelinePineLogging", platforms: [.iOS(.v14), .watchOS(.v7), .macOS(.v11)], - dependencies: [ - .package(path: "Packages/FelinePine"), - .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0") - ], products: [ .library( name: "FelinePineLogging", targets: ["FelinePineLogging"] ) ], + dependencies: [ + .package(path: "Packages/FelinePine"), + .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0") + ], targets: [ .target( name: "FelinePineLogging", + dependencies: [ + "FelinePine", + .product(name: "Logging", package: "swift-log") + ], swiftSettings: [ SwiftSetting.enableUpcomingFeature("BareSlashRegexLiterals"), SwiftSetting.enableUpcomingFeature("ConciseMagicFile"), @@ -27,11 +31,8 @@ let package = Package( SwiftSetting.enableUpcomingFeature("ImplicitOpenExistentials"), SwiftSetting.enableUpcomingFeature("StrictConcurrency"), SwiftSetting.enableUpcomingFeature("DisableOutwardActorInference"), - SwiftSetting.enableExperimentalFeature("StrictConcurrency") - ], - dependencies: [ - "FelinePine", - .product(name: "Logging", package: "swift-log") + SwiftSetting.enableExperimentalFeature("StrictConcurrency"), + SwiftSetting.enableExperimentalFeature("AccessLevelOnImport") ] ), .testTarget( diff --git a/Sources/FelinePineLogging/Feline.swift b/Sources/FelinePineLogging/Feline.swift index b71cb18..ae7fe7e 100644 --- a/Sources/FelinePineLogging/Feline.swift +++ b/Sources/FelinePineLogging/Feline.swift @@ -28,7 +28,7 @@ // public import FelinePine -import Foundation +internal import Foundation public import Logging extension Feline where Self: Pine, Self.LoggingSystemType.Category: CaseIterable { diff --git a/Sources/FelinePineLogging/Loggable.swift b/Sources/FelinePineLogging/Loggable.swift index e32229f..a6e0506 100644 --- a/Sources/FelinePineLogging/Loggable.swift +++ b/Sources/FelinePineLogging/Loggable.swift @@ -27,15 +27,44 @@ // OTHER DEALINGS IN THE SOFTWARE. // -import Foundation -import Logging - -// #if canImport(os) -// public typealias FelinePineProtocol = Feline & Pine -// #else -// public typealias FelinePineProtocol = Feline -// #endif -// -///// Loggable type for a ``LoggingSystem``. -// public protocol Loggable: FelinePineProtocol -// where LoggingSystemType: LoggingSystem {} +//// +//// Loggable.swift +//// FelinePine +//// +//// Created by Leo Dion. +//// Copyright © 2024 BrightDigit. +//// +//// Permission is hereby granted, free of charge, to any person +//// obtaining a copy of this software and associated documentation +//// files (the “Software”), to deal in the Software without +//// restriction, including without limitation the rights to use, +//// copy, modify, merge, publish, distribute, sublicense, and/or +//// sell copies of the Software, and to permit persons to whom the +//// Software is furnished to do so, subject to the following +//// conditions: +//// +//// The above copyright notice and this permission notice shall be +//// included in all copies or substantial portions of the Software. +//// +//// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +//// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +//// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +//// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +//// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +//// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +//// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +//// OTHER DEALINGS IN THE SOFTWARE. +//// +// +// import Foundation +// import Logging +// +//// #if canImport(os) +//// public typealias FelinePineProtocol = Feline & Pine +//// #else +//// public typealias FelinePineProtocol = Feline +//// #endif +//// +/////// Loggable type for a ``LoggingSystem``. +//// public protocol Loggable: FelinePineProtocol +//// where LoggingSystemType: LoggingSystem {} diff --git a/Sources/FelinePineLogging/LoggingSystem+LoggingSystemRepository.swift b/Sources/FelinePineLogging/LoggingSystem+LoggingSystemRepository.swift index d39bafc..d73647c 100644 --- a/Sources/FelinePineLogging/LoggingSystem+LoggingSystemRepository.swift +++ b/Sources/FelinePineLogging/LoggingSystem+LoggingSystemRepository.swift @@ -27,7 +27,7 @@ // OTHER DEALINGS IN THE SOFTWARE. // -import Foundation +internal import Foundation public import protocol FelinePine.LoggingSystem public import struct Logging.Logger diff --git a/Sources/FelinePineLogging/NSLocking.swift b/Sources/FelinePineLogging/NSLocking.swift index 7d6e180..c7cd696 100644 --- a/Sources/FelinePineLogging/NSLocking.swift +++ b/Sources/FelinePineLogging/NSLocking.swift @@ -27,7 +27,7 @@ // OTHER DEALINGS IN THE SOFTWARE. // -import Foundation +internal import Foundation #if !canImport(os) extension NSLocking { diff --git a/Sources/FelinePineLogging/Pine.swift b/Sources/FelinePineLogging/Pine.swift index f25bfdc..971d413 100644 --- a/Sources/FelinePineLogging/Pine.swift +++ b/Sources/FelinePineLogging/Pine.swift @@ -27,51 +27,17 @@ // OTHER DEALINGS IN THE SOFTWARE. // -//// -//// Pine.swift -//// FelinePineLogging -//// -//// Created by Leo Dion. -//// Copyright © 2024 BrightDigit. -//// -//// Permission is hereby granted, free of charge, to any person -//// obtaining a copy of this software and associated documentation -//// files (the “Software”), to deal in the Software without -//// restriction, including without limitation the rights to use, -//// copy, modify, merge, publish, distribute, sublicense, and/or -//// sell copies of the Software, and to permit persons to whom the -//// Software is furnished to do so, subject to the following -//// conditions: -//// -//// The above copyright notice and this permission notice shall be -//// included in all copies or substantial portions of the Software. -//// -//// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -//// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -//// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -//// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -//// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -//// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -//// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -//// OTHER DEALINGS IN THE SOFTWARE. -//// -// -// import Foundation -// -// #if swift(<6.0) -// import Logging -// #else -// public import Logging -// #endif -// -// #if canImport(Logging) -// /// Defines a shared logger for the type. -// /// -// /// Provides a shared ``Logger`` to use in this type. -// public protocol Pine { -// /// Shared logger for Type. -// static var logger: Logger { -// get -// } -// } -// #endif +public import Foundation +public import Logging + +#if !canImport(os) + /// Defines a shared logger for the type. + /// + /// Provides a shared ``Logger`` to use in this type. + public protocol Pine { + /// Shared logger for Type. + static var logger: Logger { + get + } + } +#endif