diff options
| author | Felix Hanley <felix@userspace.com.au> | 2020-05-20 01:35:50 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2020-05-20 01:36:03 +0000 |
| commit | 21b31fdacf93bd5bb54937fb7c25a73b61205344 (patch) | |
| tree | f1c50ff4a8dab9bd6e86ed3a8402ac0b1ef34ba0 /options.go | |
| parent | 0b93ba86bf1b495ebb765a6cdca20a121ac1e9c7 (diff) | |
| download | logger-21b31fdacf93bd5bb54937fb7c25a73b61205344.tar.gz logger-21b31fdacf93bd5bb54937fb7c25a73b61205344.tar.bz2 | |
Reduce levels to debug and not debug
Diffstat (limited to 'options.go')
| -rw-r--r-- | options.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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 } } |
