Skip to content

Give every solve its own logger - #40

Open
lkdvos wants to merge 5 commits into
mainfrom
layered-logging
Open

lkdvos wants to merge 5 commits into
mainfrom
layered-logging

Conversation

@lkdvos

@lkdvos lkdvos commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

This PR makes logging compose across nested scopes and nested solves.

  • Every solve descends one level in the logger: a solve named name uses the name => logger entry of the current AlgorithmLogger, and makes it the current logger while it runs. Actions are therefore given per solve, e.g. with_algorithmlogger(:HeronAlgorithm => AlgorithmLogger(:PostStep => action)), and no longer reach subproblems solved from within step!.
  • solve and solve! take a name keyword, defaulting to algorithm_name(algorithm), the name of the type of the algorithm unless overloaded. An algorithm that solves several subproblems with the same algorithm can give each its own name.
  • A nested with_algorithmlogger adds to the enclosing logger instead of replacing it. A context present in both runs the outer action first.
  • NoLogging() silences a single context, also when it was set by an enclosing scope.
  • with_algorithmlogger(...; inherit = false) discards the enclosing scopes, and with_algorithmlogger also accepts an AlgorithmLogger, which is now exported.

This change is breaking: existing with_algorithmlogger(:PostStep => action) calls need to name the solve they apply to.

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/AlgorithmsInterface.jl 100.00% <ø> (ø)
src/interface/algorithm.jl 100.00% <100.00%> (ø)
src/interface/interface.jl 100.00% <100.00%> (ø)
src/logging.jl 100.00% <100.00%> (+2.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos lkdvos changed the title Merge nested logger scopes and add default_logger Give every solve its own logger Nov 7, 2026
@lkdvos
lkdvos marked this pull request as ready for review November 9, 2026 15:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant