mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-07-28 23:49:33 +00:00
Add config file support
This commit is contained in:
31
pkg/cli/cmds/debug.go
Normal file
31
pkg/cli/cmds/debug.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package cmds
|
||||
|
||||
import (
|
||||
"github.com/rancher/k3s/pkg/version"
|
||||
"github.com/rancher/spur/cli"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
Debug = false
|
||||
DebugFlag = cli.BoolFlag{
|
||||
Name: "debug",
|
||||
Usage: "(logging) Turn on debug logs",
|
||||
Destination: &Debug,
|
||||
EnvVars: []string{version.ProgramUpper + "_DEBUG"},
|
||||
}
|
||||
)
|
||||
|
||||
func DebugContext(f func(*cli.Context) error) func(ctx *cli.Context) error {
|
||||
return func(ctx *cli.Context) error {
|
||||
if f != nil {
|
||||
if err := f(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if Debug {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user