Skip to content

Commit

Permalink
Merge aa2d264 into c509139
Browse files Browse the repository at this point in the history
  • Loading branch information
crbrox committed Apr 20, 2018
2 parents c509139 + aa2d264 commit f0d952a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,18 @@ func (l *Logger) GetWriter() io.Writer {

func (l *Logger) log(logLevel level, context interface{}, message string, args ...interface{}) {
if logLevel >= l.logLevel {
var buf bytes.Buffer
writeDoc(&buf, time.Now(), LogLevelNames[logLevel], l.context, context, fmt.Sprintf(message, args...))
var (
text string
buf bytes.Buffer
)

if len(args) == 0 {
text = message
} else {
text = fmt.Sprintf(message, args...)
}

writeDoc(&buf, time.Now(), LogLevelNames[logLevel], l.context, context, text)
bytes := buf.Bytes()
l.mutex.Lock()
defer l.mutex.Unlock()
Expand Down

0 comments on commit f0d952a

Please sign in to comment.