Package term provides tools for logging to a terminal.
func IsTerminal ¶
IsTerminal returns true if w writes to a terminal.
func NewColorLogger ¶
NewColorLogger returns a Logger which writes colored logs to w. ANSI color codes for the colors returned by color are added to the formatted output from the Logger returned by newLogger and the combined result written to w.
func NewColorWriter ¶
NewColorWriter returns an io.Writer that writes to w and provides cross platform support for ANSI color codes. If w is not a terminal it is returned unmodified.
NewLogger returns a Logger that takes advantage of terminal features if possible. Log events are formatted by the Logger returned by newLogger. If w is a terminal each log event is colored according to the color function.
Example (LevelColors) ¶
Example (RedErrors) ¶