Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the public ParseLevel function which enables the user to construct a log level based on ASCII text input. This re-uses the UnmarshalText method of Level for the heavy-lifting, but it avoids the user having to declare a local `Level` variable first. ```go var level zapcore.Level err := level.UnmarshalText([]byte("debug")) // versus level, err := zapcore.ParseLevel("debug") ``` #### Usage ```go level, err := zapcore.LevelFromString("info") // zapcore.InfoLevel, nil level, err := zapcore.LevelFromString("DEBUG") // zapcore.DebugLevel, nil level, err := zapcore.LevelFromString("FOO") // 0, "invalid level" ``` Co-authored-by: Abhinav Gupta <[email protected]>
- Loading branch information