Documentation
¶
Overview ¶
Package mirror duplicates os.Stdout and os.Stderr to a file. ANSI escape sequences are stripped from the file copy, producing clean text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mirror ¶
type Mirror struct {
// contains filtered or unexported fields
}
Mirror captures os.Stdout and os.Stderr writes and duplicates them to a file. The terminal gets raw bytes (with ANSI colors); the file gets stripped plain text. Create with New, close with Close to restore original descriptors.
func New ¶
New creates a mirror that duplicates stdout and stderr to the file at path. The file is truncated on creation. ANSI escape sequences are stripped from the file copy so it contains clean, readable text. Call Close to restore original stdout/stderr and flush remaining output.
func (*Mirror) Close ¶
func (m *Mirror) Close()
Close restores original stdout/stderr, flushes remaining pipe data, and closes the file.
func (*Mirror) OrigStdout ¶
OrigStdout returns the original os.Stdout that was captured before the mirror replaced it.