Skip to content

Commit 703284a

Browse files
committed
GroupAction -> ActionGroup
1 parent bd1d900 commit 703284a

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/src/logging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ history2 = CaptureHistory()
226226
227227
with_algorithmlogger(
228228
:Start => record_start,
229-
:PostStep => GroupAction([iter_printer, history2]),
229+
:PostStep => ActionGroup(iter_printer, history2),
230230
:Stop => CallbackAction() do problem, algorithm, state
231231
@printf("Captured %d iterates in %.3fs\n", length(history2.iterates), time() - start_time[])
232232
end,
@@ -473,7 +473,7 @@ Implementing logging involves three main components:
473473

474474
2. **AlgorithmLogger**: Map contexts (`:Start`, `:PostStep`, etc.) to actions.
475475
- Construct with `with_algorithmlogger(:Context => action, ...)`.
476-
- Use `GroupAction` to compose multiple actions at one context.
476+
- Use `ActionGroup` to compose multiple actions at one context.
477477

478478
3. **Custom contexts**: Emit domain-specific events from algorithms.
479479
- Call `emit_message(problem, algorithm, state, :YourContext)`.

src/AlgorithmsInterface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export StopAfter, StopAfterIteration, StopWhenAll, StopWhenAny
3333
export is_finished, is_finished!, get_reason, indicates_convergence
3434

3535
# Logging interface
36-
export LoggingAction, CallbackAction, IfAction, GroupAction
36+
export LoggingAction, CallbackAction, IfAction, ActionGroup
3737
export with_algorithmlogger, emit_message
3838

3939
end # module AlgorithmsInterface

src/logging.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ Entry-point for defining an implementation of how to handle a logging event for
2121
# Concrete LoggingActions
2222
# -----------------------
2323
"""
24-
GroupAction(actions::LoggingAction...)
25-
GroupAction(actions::Vector{<:LoggingAction})
24+
ActionGroup(actions::LoggingAction...)
25+
ActionGroup(actions::Vector{<:LoggingAction})
2626
2727
Concrete [`LoggingAction`](@ref) that can be used to sequentially perform each of the `actions`.
2828
"""
29-
struct GroupAction{A <: LoggingAction} <: LoggingAction
29+
struct ActionGroup{A <: LoggingAction} <: LoggingAction
3030
actions::Vector{A}
3131
end
32-
GroupAction(actions::LoggingAction...) = GroupAction(collect(LoggingAction, actions))
32+
ActionGroup(actions::LoggingAction...) = ActionGroup(collect(LoggingAction, actions))
3333

3434
function handle_message!(
35-
action::GroupAction, problem::Problem, algorithm::Algorithm, state::State; kwargs...
35+
action::ActionGroup, problem::Problem, algorithm::Algorithm, state::State; kwargs...
3636
)
3737
for child in action.actions
3838
handle_message!(child, problem, algorithm, state; kwargs...)

test/logging.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ end
100100
end
101101
end
102102

103-
@testset "GroupAction logs multiple actions" begin
103+
@testset "ActionGroup logs multiple actions" begin
104104
problem = LogDummyProblem()
105105
algorithm = LogDummyAlgorithm(StopAfterIteration(2))
106106

@@ -114,7 +114,7 @@ end
114114
@info "Logger2 Iter $(state.iteration)"
115115
end
116116

117-
group_logger = GroupAction(logger1, logger2)
117+
group_logger = ActionGroup(logger1, logger2)
118118

119119
# Expect both loggers to log for each iteration
120120
@test_logs (:info, "Logger1 Iter 1") (:info, "Logger2 Iter 1") (:info, "Logger1 Iter 2") (:info, "Logger2 Iter 2") begin

0 commit comments

Comments
 (0)