From 2dcd7bca2f3e69fb6f1770ec0bf740d8956978ca Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 25 Apr 2022 15:41:17 +0200 Subject: enable logging of dates by default Also, move documentation of the defaults to the struct. --- pkg/log/log.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'pkg') 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 } -- cgit v1.2.3