set loglevel in Before function

This commit is contained in:
onyx-and-iris 2025-05-07 00:30:47 +01:00
parent 28baa2ed00
commit 5e399b8590

View File

@ -55,6 +55,14 @@ func main() {
Sources: cli.EnvVars("Q3RCON_LOGLEVEL"),
},
},
Before: func(ctx context.Context, cmd *cli.Command) (context.Context, error) {
logLevel, err := log.ParseLevel(cmd.String("loglevel"))
if err != nil {
return ctx, fmt.Errorf("invalid log level: %w", err)
}
log.SetLevel(logLevel)
return ctx, nil
},
Action: func(_ context.Context, cmd *cli.Command) error {
errChan := make(chan error)