rm risky panics

This commit is contained in:
Denis Bilenko 2024-12-09 14:24:30 +01:00
parent 207c5fd02a
commit 65b4f78331
1 changed files with 4 additions and 9 deletions

View File

@ -84,19 +84,14 @@ func initLogFlags(cmd *cobra.Command) *logFlags {
// Configure defaults from environment, if applicable. // Configure defaults from environment, if applicable.
// If the provided value is invalid it is ignored. // If the provided value is invalid it is ignored.
if v, ok := env.Lookup(cmd.Context(), envLogFile); ok { if v, ok := env.Lookup(cmd.Context(), envLogFile); ok {
if err := f.file.Set(v); err != nil { // QQQ log the error? here and below
panic(err) _ = f.file.Set(v)
}
} }
if v, ok := env.Lookup(cmd.Context(), envLogLevel); ok { if v, ok := env.Lookup(cmd.Context(), envLogLevel); ok {
if err := f.level.Set(v); err != nil { _ = f.level.Set(v)
panic(err)
}
} }
if v, ok := env.Lookup(cmd.Context(), envLogFormat); ok { if v, ok := env.Lookup(cmd.Context(), envLogFormat); ok {
if err := f.output.Set(v); err != nil { _ = f.output.Set(v)
panic(err)
}
} }
flags := cmd.PersistentFlags() flags := cmd.PersistentFlags()