aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2022-04-25 15:41:17 +0200
committerLinus Nordberg <linus@nordberg.se>2022-04-25 16:15:24 +0200
commit2dcd7bca2f3e69fb6f1770ec0bf740d8956978ca (patch)
treea09ae81d582482e3d7140d837fcd6752183d561d
parente7cfaf764d5ec6c88b0cb076191ac02412cbde69 (diff)
enable logging of dates by default
Also, move documentation of the defaults to the struct.
-rw-r--r--pkg/log/log.go18
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
}