This commit is contained in:
2023-03-05 14:37:02 -05:00
parent 5b8b912844
commit 8524efb765
23 changed files with 926 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
import Dependencies
import Foundation
@_exported import Logging
import LoggingFormatAndPipe
extension Logger: DependencyKey {
fileprivate static func factory(label: String) -> Self {
Logger(label: "dots") { _ in
LoggingFormatAndPipe.Handler(
formatter: BasicFormatter([.message]),
pipe: LoggerTextOutputStreamPipe.standardOutput
)
}
}
public static var liveValue: Logger {
factory(label: "dots")
}
public static var testValue: Logger {
factory(label: "dots-test")
}
}
extension DependencyValues {
public var logger: Logger {
get { self[Logger.self] }
set { self[Logger.self] = newValue }
}
}