20 lines
271 B
Go
20 lines
271 B
Go
|
package logger
|
||
|
|
||
|
import (
|
||
|
"log/slog"
|
||
|
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
type Level = slog.Level
|
||
|
|
||
|
func ParseLevel(s string) (Level, error) {
|
||
|
var level Level
|
||
|
|
||
|
if err := level.UnmarshalText([]byte(s)); err != nil {
|
||
|
return level, errors.WithStack(err)
|
||
|
}
|
||
|
|
||
|
return level, nil
|
||
|
}
|