mirror of
https://github.com/chainguard-dev/clog
synced 2026-07-06 22:12:46 +00:00
I don't like any of the names here, and we might want it to be in a separate subpackage. This lets you say `--log-level=DEBUG` to set the level. The default is still INFO. --------- Signed-off-by: Jason Hall <jason@chainguard.dev>
16 lines
343 B
Go
16 lines
343 B
Go
package slag
|
|
|
|
import "log/slog"
|
|
|
|
type Level slog.Level
|
|
|
|
func (l *Level) Set(s string) error {
|
|
var ll slog.Level
|
|
if err := ll.UnmarshalText([]byte(s)); err != nil {
|
|
return err
|
|
}
|
|
*l = Level(ll)
|
|
return nil
|
|
}
|
|
func (l *Level) String() string { return slog.Level(*l).String() }
|
|
func (l *Level) Level() slog.Level { return slog.Level(*l) }
|