Skip to content

Commit 1bd16d0

Browse files
Copilotjosecelano
andcommitted
feat: make StandardSink public for composite usage
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]>
1 parent e8a98e5 commit 1bd16d0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/presentation/user_output.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ impl VerbosityFilter {
12251225
}
12261226

12271227
// ============================================================================
1228-
// PRIVATE - Output Sink Implementations
1228+
// Output Sink Implementations
12291229
// ============================================================================
12301230

12311231
/// Standard sink writing to stdout/stderr
@@ -1248,14 +1248,17 @@ impl VerbosityFilter {
12481248
/// Box::new(std::io::stderr())
12491249
/// );
12501250
/// ```
1251-
struct StandardSink {
1251+
pub struct StandardSink {
12521252
stdout: StdoutWriter,
12531253
stderr: StderrWriter,
12541254
}
12551255

12561256
impl StandardSink {
12571257
/// Create a new standard sink with the given writers
1258-
fn new(stdout: Box<dyn Write + Send + Sync>, stderr: Box<dyn Write + Send + Sync>) -> Self {
1258+
///
1259+
/// This is useful for testing or when you need custom writers.
1260+
#[must_use]
1261+
pub fn new(stdout: Box<dyn Write + Send + Sync>, stderr: Box<dyn Write + Send + Sync>) -> Self {
12591262
Self {
12601263
stdout: StdoutWriter::new(stdout),
12611264
stderr: StderrWriter::new(stderr),
@@ -1266,7 +1269,8 @@ impl StandardSink {
12661269
///
12671270
/// This is the default console sink that writes to the standard
12681271
/// output and error streams.
1269-
fn default_console() -> Self {
1272+
#[must_use]
1273+
pub fn default_console() -> Self {
12701274
Self::new(Box::new(std::io::stdout()), Box::new(std::io::stderr()))
12711275
}
12721276
}

0 commit comments

Comments
 (0)