aboutsummaryrefslogtreecommitdiff
path: root/options.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2020-05-20 01:35:50 +0000
committerFelix Hanley <felix@userspace.com.au>2020-05-20 01:36:03 +0000
commit21b31fdacf93bd5bb54937fb7c25a73b61205344 (patch)
treef1c50ff4a8dab9bd6e86ed3a8402ac0b1ef34ba0 /options.go
parent0b93ba86bf1b495ebb765a6cdca20a121ac1e9c7 (diff)
downloadlogger-21b31fdacf93bd5bb54937fb7c25a73b61205344.tar.gz
logger-21b31fdacf93bd5bb54937fb7c25a73b61205344.tar.bz2
Reduce levels to debug and not debug
Diffstat (limited to 'options.go')
-rw-r--r--options.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/options.go b/options.go
index cace429..4f75a07 100644
--- a/options.go
+++ b/options.go
@@ -1,6 +1,8 @@
package logger
import (
+ "os"
+
"src.userspace.com.au/logger/message"
)
@@ -15,18 +17,18 @@ func Writer(f message.Writer) Option {
}
}
-// Level configures the minimum level to log.
-func Level(lvl message.Level) Option {
+// ForceDebug sets debug.
+func ForceDebug(b bool) Option {
return func(l *Logger) error {
- l.SetLevel(lvl)
+ l.debug = b
return nil
}
}
-// LevelAsString configures the minimum level to log.
-func LevelAsString(lvl string) Option {
+// DebugEnvVar sets debug if the envvar 'v' is not empty.
+func DebugEnvVar(v string) Option {
return func(l *Logger) error {
- l.SetLevelAsString(lvl)
+ l.debug = (os.Getenv(v) != "")
return nil
}
}