diff options
author | Linus Nordberg <linus@nordberg.se> | 2022-04-25 15:41:17 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2022-04-25 16:15:24 +0200 |
commit | 2dcd7bca2f3e69fb6f1770ec0bf740d8956978ca (patch) | |
tree | a09ae81d582482e3d7140d837fcd6752183d561d /pkg/log/log.go | |
parent | e7cfaf764d5ec6c88b0cb076191ac02412cbde69 (diff) |
enable logging of dates by default
Also, move documentation of the defaults to the struct.
Diffstat (limited to 'pkg/log/log.go')
-rw-r--r-- | pkg/log/log.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/log/log.go b/pkg/log/log.go index ad4a692..5df9aee 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -45,36 +45,36 @@ const ( ) type logger struct { - log.Logger + log.Logger // Default writer: os.Stderr. - lv level - date bool - color bool + lv level // Logging level. Default: InfoLevel. + date bool // Logging dates or not: Default: true. + color bool // Using colors or not: Default: false. } var l logger func init() { - l = newLogger(InfoLevel, os.Stderr, false, false) + l = newLogger(InfoLevel, os.Stderr, true, false) } // SetLevel sets the logging level. Available options: DebugLevel, InfoLevel, -// WarningLevel, ErrorLevel, FatalLevel. Default: InfoLevel. +// WarningLevel, ErrorLevel, FatalLevel. func SetLevel(lv level) { l.lv = lv } -// SetOutput sets the logging output to a particular writer. Default: os.Stderr. +// SetOutput sets the logging output to a particular writer. func SetOutput(writer io.Writer) { l = newLogger(l.lv, writer, l.date, l.color) } -// SetDate (un)sets date output. Default: off. +// SetDate (un)sets date output. func SetDate(ok bool) { l.date = ok } -// SetColor (un)sets terminal colors. Default: off. +// SetColor (un)sets terminal colors. func SetColor(ok bool) { l.color = ok } |