feat: Moves logging extensions into it's own module, moves configuration merging into config-client, fixes merging bug.
This commit is contained in:
28
Sources/LoggingExtensions/LoggingOptions.swift
Normal file
28
Sources/LoggingExtensions/LoggingOptions.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
import Dependencies
|
||||
import ShellClient
|
||||
|
||||
public struct LoggingOptions: Equatable, Sendable {
|
||||
|
||||
let command: String
|
||||
let executableName: String
|
||||
let verbose: Int
|
||||
|
||||
public init(
|
||||
executableName: String = "bump-version",
|
||||
command: String,
|
||||
verbose: Int
|
||||
) {
|
||||
self.executableName = executableName
|
||||
self.command = command
|
||||
self.verbose = verbose
|
||||
}
|
||||
|
||||
public func withLogger<T>(_ operation: () async throws -> T) async rethrows -> T {
|
||||
try await withDependencies {
|
||||
$0.logger = makeLogger()
|
||||
$0.logger.logLevel = .init(verbose: verbose)
|
||||
} operation: {
|
||||
try await operation()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user