(ctx *cli.Context)
| 61 | } |
| 62 | |
| 63 | func ReadCLIConfig(ctx *cli.Context) CLIConfig { |
| 64 | cfg := CLIConfig{ |
| 65 | Level: ctx.GlobalString(LevelFlagName), |
| 66 | Format: ctx.GlobalString(FormatFlagName), |
| 67 | Color: ctx.GlobalBool(ColorFlagName), |
| 68 | } |
| 69 | if err := cfg.check(); err != nil { |
| 70 | panic(err) |
| 71 | } |
| 72 | return cfg |
| 73 | } |
| 74 | |
| 75 | func levelFromString(lvlString string) (slog.Level, error) { |
| 76 | lvlString = strings.ToLower(lvlString) // ignore case |