Skip to content

Introduce UserOutput foundation (towards #60)#140

Open
cansin wants to merge 3 commits into
useocl:mainfrom
cansin:issue-60-user-output
Open

Introduce UserOutput foundation (towards #60)#140
cansin wants to merge 3 commits into
useocl:mainfrom
cansin:issue-60-user-output

Conversation

@cansin

@cansin cansin commented Jun 9, 2026

Copy link
Copy Markdown

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, raw
System.out/System.err and ad-hoc PrintWriter arguments. That's a large
migration; 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)

  • OutputLevelNORMAL, INFO, WARN, ERROR, TRACE.
  • UserOutput — interface with a single print(OutputLevel, String) that drives
    the derived println and 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

UserOutputTest covers stream routing, per-level separation, the convenience
methods, println line separators, the silent output, and the factories. The
full use-core suite (including the ArchUnit cyclic-dependency checks) passes.

Suggested next steps (separate PRs)

Adopt UserOutput where a PrintWriter is currently threaded through (e.g.
USECompiler), then migrate Log's user-facing calls, keeping developer
logging on a logging framework.

claude added 3 commits June 9, 2026 06:16
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 <noreply@anthropic.com>
https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
@cansin cansin force-pushed the issue-60-user-output branch from f31f695 to 587430e Compare June 9, 2026 06:43
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.

Unify user and developer output in USE

2 participants