Skip to content

Commit c356152

Browse files
committed
Add GroupAction test
1 parent 51f7a68 commit c356152

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/logging.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,27 @@ end
9999
end
100100
end
101101
end
102+
103+
@testset "GroupAction logs multiple actions" begin
104+
problem = LogDummyProblem()
105+
algorithm = LogDummyAlgorithm(StopAfterIteration(2))
106+
107+
# First logger
108+
logger1 = CallbackAction() do problem, algorithm, state
109+
@info "Logger1 Iter $(state.iteration)"
110+
end
111+
112+
# Second logger
113+
logger2 = CallbackAction() do problem, algorithm, state
114+
@info "Logger2 Iter $(state.iteration)"
115+
end
116+
117+
group_logger = GroupAction(logger1, logger2)
118+
119+
# Expect both loggers to log for each iteration
120+
@test_logs (:info, "Logger1 Iter 1") (:info, "Logger2 Iter 1") (:info, "Logger1 Iter 2") (:info, "Logger2 Iter 2") begin
121+
with_algorithmlogger(:PostStep => group_logger) do
122+
solve(problem, algorithm)
123+
end
124+
end
125+
end

0 commit comments

Comments
 (0)