Skip to content

Commit 45b8c98

Browse files
committed
Exposed Color()
Signed-off-by: Vishal Rana <[email protected]>
1 parent 431777a commit 45b8c98

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

log/log.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"strconv"
1515

16-
"github.com/mattn/go-isatty"
1716
"github.com/valyala/fasttemplate"
1817

1918
"github.com/labstack/gommon/color"
@@ -112,17 +111,21 @@ func (l *Logger) Output() io.Writer {
112111
return l.output
113112
}
114113

115-
func (l *Logger) SetHeader(h string) {
116-
l.template = l.newTemplate(h)
117-
}
118-
119114
func (l *Logger) SetOutput(w io.Writer) {
120115
l.output = w
121116
if w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
122117
l.DisableColor()
123118
}
124119
}
125120

121+
func (l *Logger) Color() *color.Color {
122+
return l.color
123+
}
124+
125+
func (l *Logger) SetHeader(h string) {
126+
l.template = l.newTemplate(h)
127+
}
128+
126129
func (l *Logger) Print(i ...interface{}) {
127130
fmt.Fprintln(l.output, i...)
128131
}

0 commit comments

Comments
 (0)