Set updates the value of the allowed level. Implments flag.Value.
(s string)
| 57 | |
| 58 | // Set updates the value of the allowed level. Implments flag.Value. |
| 59 | func (l *Level) Set(s string) error { |
| 60 | switch s { |
| 61 | case "debug": |
| 62 | l.Option = level.AllowDebug() |
| 63 | case "info": |
| 64 | l.Option = level.AllowInfo() |
| 65 | case "warn": |
| 66 | l.Option = level.AllowWarn() |
| 67 | case "error": |
| 68 | l.Option = level.AllowError() |
| 69 | default: |
| 70 | return errors.Errorf("unrecognized log level %q", s) |
| 71 | } |
| 72 | |
| 73 | l.s = s |
| 74 | return nil |
| 75 | } |