Skip to content

Commit

Permalink
♻️ Add Action to message in custom log
Browse files Browse the repository at this point in the history
  • Loading branch information
yermukhanbet committed Oct 6, 2022
1 parent a786f19 commit 8cbaf39
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ extension Reducer where State: LoggableState {
/// - Parameters:
/// - isDebug: is debug configuration on
/// - message: custom log message
public func log(isDebug: Bool, with message: String) -> Self {
public func log(
isDebug: Bool,
with message: @escaping ((Action) -> String)
) -> Self {
.init { state, action, environment in
if isDebug {
state.logs.append(.init(message: message))
state.logs.append(.init(message: message(action)))
}
return self.run(&state, action, environment)
}
Expand Down

0 comments on commit 8cbaf39

Please sign in to comment.