1// Package term provides tools for logging to a terminal. 2package term 3 4import ( 5 "io" 6 7 "github.com/go-kit/kit/log" 8) 9 10// NewLogger returns a Logger that takes advantage of terminal features if 11// possible. Log events are formatted by the Logger returned by newLogger. If 12// w is a terminal each log event is colored according to the color function. 13func NewLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger { 14 if !IsTerminal(w) { 15 return newLogger(w) 16 } 17 return NewColorLogger(NewColorWriter(w), newLogger, color) 18} 19 20type fder interface { 21 Fd() uintptr 22} 23