Skip to content

Commit

Permalink
runned precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugoro1 committed Jun 17, 2024
1 parent 72d3d04 commit bb3cdba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion level.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (l LogLevel) String() string {
}
}

// UnmarshalText applies the LogLevel type when inputted text is valid.
func (l *LogLevel) UnmarshalText(text []byte) error {
if ok := l.unmarshalText(bytes.ToLower(text)); ok {
return nil
Expand All @@ -59,7 +60,7 @@ func (l *LogLevel) validate() error {
return errors.New("can't parse nil values")
}

if l.unmarshalText(bytes.ToLower([]byte(l.String()))) == false {
if !l.unmarshalText(bytes.ToLower([]byte(l.String()))) {
return errors.New("log level value is not accepted")
}

Expand All @@ -83,6 +84,7 @@ func (l *LogLevel) unmarshalText(text []byte) bool {
return true
}

// ParseLevel return a new LogLevel using text, and will return err if inputted text is not accepted.
func ParseLevel(text string) (LogLevel, error) {
var level LogLevel

Expand Down

0 comments on commit bb3cdba

Please sign in to comment.