Skip to content

Commit

Permalink
feature: ability to use consol output to file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ak-Army committed Jun 26, 2024
1 parent bc19a28 commit 1aec438
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ func NewConsoleOutputW(w io.Writer, noTerm Output) Output {
}
return noTerm
}

// NewForceConsoleOutputW returns a Output printing message in a colored human readable form with
// the provided writer. If the writer is not on a terminal, a color is returned stripped.
func NewForceConsoleOutputW(w io.Writer) Output {
return consoleOutput{
w: w,
isTerminal: isTerminal(w),
}
}

func (o consoleOutput) Write(fields map[string]interface{}) error {
if o.isTerminal {
return o.writeWithColor(fields)
Expand Down

0 comments on commit 1aec438

Please sign in to comment.