Repository navigation
Add OutputSink abstraction for multi-destination output - #143
Merged
Merged
Conversation
Implement OutputSink trait and StandardSink/CompositeSink implementations to enable writing output to multiple destinations beyond stdout/stderr. Changes: - Add OutputSink trait with write_message() method for extensible output destinations - Implement StandardSink for backward-compatible stdout/stderr routing - Implement CompositeSink for multi-destination fan-out - Add example FileSink and TelemetrySink implementations - Update UserOutput to use Box<dyn OutputSink> instead of direct writers - Add with_sink() constructor for custom sink configuration - Maintain backward compatibility with existing constructors - Add 15 comprehensive tests for sinks and integration - Document flush() limitation with sink abstraction All existing tests pass (126) plus 15 new sink tests. Co-authored-by: josecelano <[email protected]>
- Add backticks to UserOutput, OutputSink, StandardSink in doc comments - Add backticks to Ok(()) in doc comment - Run cargo fmt to format code Co-authored-by: josecelano <[email protected]>
Make StandardSink and its constructors public so users can create composite sinks with StandardSink + FileSink/TelemetrySink combinations. This enables the use cases shown in the issue: - Console + File output - Console + Telemetry output - Custom combinations Co-authored-by: josecelano <[email protected]>
Copilot
AI
changed the title
[WIP] Add OutputSink abstraction layer for output destinations
Add OutputSink abstraction for multi-destination output
Nov 5, 2025
josecelano
marked this pull request as ready for review
November 5, 2025 10:02
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.
Implements composable sink pattern enabling output to multiple destinations (console, file, telemetry) simultaneously while maintaining backward compatibility.
Changes
Core Abstractions
OutputSinktrait withwrite_message(message, formatted)methodStandardSinkfor stdout/stderr routing (default, backward compatible)CompositeSinkfor fan-out to multiple sinksExample Implementations
FileSinkfor file outputTelemetrySinkstub for observability integrationIntegration
UserOutputnow usesBox<dyn OutputSink>instead of direct writersUserOutput::with_sink()constructorStandardSinkpublic for composite usageUsage
Notes
flush()is now no-op (documented limitation - StandardSink relies on OS line-buffering)Related
Part of #102 - User Output Architecture Improvements
Depends on #127 - Message Trait (already merged)
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
192.0.2.1ssh -i /nonexistent/key -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 [email protected] echo 'SSH connected'(packet block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.