Skip to content

Commit

Permalink
Adding LevelString method to set level with string param
Browse files Browse the repository at this point in the history
  • Loading branch information
smgladkovskiy committed Jan 15, 2021
1 parent 50054fe commit 0d761f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ func Level(level zerolog.Level) zerolog.Logger {
return logger.Level(level)
}

// LevelString creates a child logger with the minimum accepted level set to level passed as string.
func LevelString(lvl string) zerolog.Logger {
level, _ := getLevel(lvl)

return logger.Level(level)
}

// Sample returns a logger with the s sampler.
func Sample(s zerolog.Sampler) zerolog.Logger {
return logger.Sample(s)
Expand Down

0 comments on commit 0d761f9

Please sign in to comment.