diff --git a/Package.swift b/Package.swift index e7c5cc37..6a4708ed 100644 --- a/Package.swift +++ b/Package.swift @@ -81,7 +81,7 @@ var package = Package( path: "Source/TestFake"), .target( name: "SabyNetwork", - dependencies: ["SabyConcurrency", "SabyJSON", "SabySafe", "SabyTime"], + dependencies: ["SabyConcurrency", "SabyJSON", "SabyTime"], path: "Source/Network"), .target( name: "SabyNumeric", diff --git a/Source/AppleFetcher/Implement/ScreenFetcher.swift b/Source/AppleFetcher/Implement/ScreenFetcher.swift index a3100c32..23d6499f 100644 --- a/Source/AppleFetcher/Implement/ScreenFetcher.swift +++ b/Source/AppleFetcher/Implement/ScreenFetcher.swift @@ -16,20 +16,22 @@ public final class ScreenFetcher: Fetcher { public typealias Value = Promise public init() {} - + public func fetch() -> Promise { - return Promise.all( + return Promise.tryAll( Promise.resolved(fetchSize()), Promise.resolved(fetchScale()), fetchOrientation() ) .then { size, scale, orientation in - Screen( + let screen = Screen( width: size.width, height: size.height, scale: scale, orientation: orientation.isLandscape ? "landscape": "portrait" ) + + return screen } } } diff --git a/Source/AppleLogger/Data/LoggerSetting.swift b/Source/AppleLogger/Data/LoggerSetting.swift index f843db11..882c0960 100644 --- a/Source/AppleLogger/Data/LoggerSetting.swift +++ b/Source/AppleLogger/Data/LoggerSetting.swift @@ -14,6 +14,9 @@ public struct LoggerSetting { /// A variable indicating logger paginate log or not. Because of `os_log`'s 1024 length limit. public var isPaginateLogEnabled: Bool = false + /// A variable indicating logger use legacy log system or not. + public var isLegacyLogEnabled: Bool = false + /// A variable used for displaying `subsystem` value in console public let subsystem: String diff --git a/Source/AppleLogger/Implement/LogService.swift b/Source/AppleLogger/Implement/LogService.swift index cbcd6e58..61c03e2b 100644 --- a/Source/AppleLogger/Implement/LogService.swift +++ b/Source/AppleLogger/Implement/LogService.swift @@ -18,20 +18,26 @@ extension LogService { _ message: String, _ printBlock: (String) -> Void ) { - if setting.isPaginateLogEnabled, message.count > LoggerConstant.paginateSize { - let logs = LoggerConstant.paginatedLog(message) - let id = arc4random() % 1000000000 - - logs.enumerated().forEach { (index, log) in - printBlock( - "\(log)" - + "\nlog={page=\(index + 1)/\(logs.count), id=\(id)}" - ) - } + let header = setting.isLegacyLogEnabled + ? "[\(setting.subsystem)][\(setting.category)]\n" + : "" + + guard setting.isPaginateLogEnabled, message.count > LoggerConstant.paginateSize + else { + printBlock(header + message) return } - printBlock(message) + let logs = LoggerConstant.paginatedLog(message) + let id = arc4random() % 1000000000 + + logs + .enumerated() + .map { (index, log) in + let footer = "\nlog={page=\(index + 1)/\(logs.count), id=\(id)}" + return header + log + footer + } + .forEach(printBlock) } } diff --git a/Source/ApplePreference/Implement/FileValuePreference.swift b/Source/ApplePreference/Implement/FileValuePreference.swift index b9ed942c..02f6f5e8 100644 --- a/Source/ApplePreference/Implement/FileValuePreference.swift +++ b/Source/ApplePreference/Implement/FileValuePreference.swift @@ -6,7 +6,6 @@ // import Foundation -import SabySafe import SabyConcurrency import SabyJSON diff --git a/Source/AppleStorage/Implement/CoreDataArrayStorage.swift b/Source/AppleStorage/Implement/CoreDataArrayStorage.swift index b3c6758b..2973bc28 100644 --- a/Source/AppleStorage/Implement/CoreDataArrayStorage.swift +++ b/Source/AppleStorage/Implement/CoreDataArrayStorage.swift @@ -8,7 +8,6 @@ import CoreData import SabyConcurrency -import SabySafe import SabySize import SabyJSON diff --git a/Source/AppleStorage/Implement/FileValueStorage.swift b/Source/AppleStorage/Implement/FileValueStorage.swift index 8b5eea89..67face3e 100644 --- a/Source/AppleStorage/Implement/FileValueStorage.swift +++ b/Source/AppleStorage/Implement/FileValueStorage.swift @@ -6,7 +6,6 @@ // import Foundation -import SabySafe import SabyConcurrency import SabyJSON diff --git a/Source/Network/Implement/Client/JSONClient.swift b/Source/Network/Implement/Client/JSONClient.swift index 673c463a..2874cfbb 100644 --- a/Source/Network/Implement/Client/JSONClient.swift +++ b/Source/Network/Implement/Client/JSONClient.swift @@ -8,7 +8,6 @@ import Foundation import SabyConcurrency -import SabySafe import SabyJSON import SabyTime