Skip to content

Commit 628e8f1

Browse files
authored
tweak logging output to include host to make it easier to track commands against multiple hosts (#93)
1 parent 2442239 commit 628e8f1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/Formic/Engine/Engine.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public actor Engine {
3535
) async throws -> [CommandExecutionResult] {
3636
var results: [CommandExecutionResult] = []
3737
for command in commands {
38-
logger?.debug("running command: \(command)")
38+
logger?.debug("\(host) running command: \(command)")
3939

4040
let result = try await run(host: host, command: command)
4141
results.append(result)
@@ -47,7 +47,7 @@ public actor Engine {
4747
break
4848
}
4949
}
50-
logger?.debug("returning \(results.count) CEResults")
50+
logger?.trace("returning \(results.count) CEResults")
5151
return results
5252
}
5353

@@ -144,7 +144,7 @@ public actor Engine {
144144
// otherwise, prep for possible retry
145145
if command.retry.retryOnFailure && numberOfRetries < command.retry.maxRetries {
146146
let delay = command.retry.strategy.delay(for: numberOfRetries, withJitter: true)
147-
logger?.trace("delaying for \(delay) due to failure before retrying command: \(command)")
147+
logger?.trace("\(host) delaying for \(delay) (due to failure) before retrying: \(command)")
148148
try await Task.sleep(for: delay)
149149
}
150150
} while command.retry.retryOnFailure && numberOfRetries < command.retry.maxRetries

Sources/Formic/RemoteHost.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ extension RemoteHost: CustomDebugStringConvertible {
105105
extension RemoteHost: CustomStringConvertible {
106106
/// The description of the host.
107107
public var description: String {
108-
return "\(self.sshAccessCredentials.username)@\(networkAddress)"
108+
return "\(self.sshAccessCredentials.username)@\(networkAddress.address)"
109109
}
110110
}
111111

0 commit comments

Comments
 (0)