Skip to content

Commit

Permalink
Initialize the isTerminal field before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
deadok22 committed Nov 24, 2021
1 parent 79c5ab6 commit 033d041
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions text_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ func (f *TextFormatter) isColored() bool {

// Format renders a single log entry
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
f.terminalInitOnce.Do(func() { f.init(entry) })

data := make(Fields)
for k, v := range entry.Data {
data[k] = v
Expand Down Expand Up @@ -193,8 +195,6 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
b = &bytes.Buffer{}
}

f.terminalInitOnce.Do(func() { f.init(entry) })

timestampFormat := f.TimestampFormat
if timestampFormat == "" {
timestampFormat = defaultTimestampFormat
Expand Down

0 comments on commit 033d041

Please sign in to comment.