Introduce UserOutput foundation (towards #60)#140
Open
cansin wants to merge 3 commits into
Open
Conversation
Issue useocl#60 proposes separating output meant for the USE user from developer logging, replacing the tangle of the static Log, USEWriter, raw System.out/err and ad-hoc PrintWriter arguments. This adds the foundation that future PRs can adopt incrementally, without changing any existing behavior: - OutputLevel: NORMAL, INFO, WARN, ERROR, TRACE - UserOutput: an interface whose single method print(level, message) drives the derived println and per-level convenience methods, plus factories for the default / silent / collecting outputs - StreamUserOutput: writes to print streams (warnings and errors to the error stream, everything else to the normal stream) - CollectingUserOutput: collects output in memory, per level, for tests and for capturing output - NullUserOutput: discards all output Purely additive (new classes only); nothing is migrated yet. Adds UserOutputTest covering stream routing, per-level separation, the convenience methods and the factories. https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
Add @author Cansin Yildiz and @author Claude to the files added in this branch, and update the copyright year to 1999-2026. Co-authored-by: Claude <[email protected]> https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
f31f695 to
587430e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A first, additive increment towards #60 (unify user and developer output).
#60 proposes separating output meant for the USE user from developer
logging, replacing the tangle of the static
Log,USEWriter, rawSystem.out/System.errand ad-hocPrintWriterarguments. That's a largemigration; this PR lands just the foundation so it can be adopted
incrementally.
This PR does not close #60 — it introduces the abstraction the issue
proposes, with no migration and no behavior change.
What's added (
org.tzi.use.util, all new)OutputLevel—NORMAL,INFO,WARN,ERROR,TRACE.UserOutput— interface with a singleprint(OutputLevel, String)that drivesthe derived
printlnand per-level convenience methods(
printlnNormal/printlnInfo/printlnWarn/printlnError/printlnTrace),plus factories for the default / silent / collecting outputs.
StreamUserOutput— writes to print streams (WARN/ERROR→ error stream,the rest → normal stream).
CollectingUserOutput— collects output in memory, per level (tests/capture).NullUserOutput— discards output.Testing
UserOutputTestcovers stream routing, per-level separation, the conveniencemethods,
printlnline separators, the silent output, and the factories. Thefull
use-coresuite (including the ArchUnit cyclic-dependency checks) passes.Suggested next steps (separate PRs)
Adopt
UserOutputwhere aPrintWriteris currently threaded through (e.g.USECompiler), then migrateLog's user-facing calls, keeping developerlogging on a logging framework.