log: golint fixes

This commit is contained in:
Mike Kinney 2019-12-09 22:15:38 -08:00
parent 784cf0a407
commit 741d9a7aaf
4 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/* /*
Package log15 provides an opinionated, simple toolkit for best-practice logging that is Package log provides an opinionated, simple toolkit for best-practice logging that is
both human and machine readable. It is modeled after the standard library's io and net/http both human and machine readable. It is modeled after the standard library's io and net/http
packages. packages.

View file

@ -51,6 +51,7 @@ var fieldPadding = make(map[string]int)
// fieldPaddingLock is a global mutex protecting the field padding map. // fieldPaddingLock is a global mutex protecting the field padding map.
var fieldPaddingLock sync.RWMutex var fieldPaddingLock sync.RWMutex
// Format is an interface for the formatting
type Format interface { type Format interface {
Format(r *Record) []byte Format(r *Record) []byte
} }

View file

@ -15,14 +15,21 @@ const ctxKey = "ctx"
const errorKey = "LOG15_ERROR" const errorKey = "LOG15_ERROR"
const skipLevel = 2 const skipLevel = 2
// Lvl is a type for logging levels
type Lvl int type Lvl int
const ( const (
// LvlCrit is the CRIT logging level
LvlCrit Lvl = iota LvlCrit Lvl = iota
// LvlError is the ERROR logging level
LvlError LvlError
// LvlWarn is the WARN logging level
LvlWarn LvlWarn
// LvlInfo is the INFO logging level
LvlInfo LvlInfo
// LvlDebug is the DEBUG logging level
LvlDebug LvlDebug
// LvlTrace is the TRACE logging level
LvlTrace LvlTrace
) )

View file

@ -6,7 +6,9 @@ import (
var ( var (
root = &logger{[]interface{}{}, new(swapHandler)} root = &logger{[]interface{}{}, new(swapHandler)}
// StdoutHandler is the standard output handler
StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat()) StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat())
// StderrHandler is the standard error handler
StderrHandler = StreamHandler(os.Stderr, LogfmtFormat()) StderrHandler = StreamHandler(os.Stderr, LogfmtFormat())
) )