refactor: move debug to internal

This commit is contained in:
decentral1se 2021-11-18 20:04:40 +01:00
parent 0b37f63248
commit cc37615d83
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 14 additions and 14 deletions

View File

@ -30,18 +30,6 @@ var VerboseFlag = &cli.BoolFlag{
Usage: "Show INFO messages",
}
// Debug stores the variable from DebugFlag.
var Debug bool
// DebugFlag turns on/off verbose logging down to the DEBUG level.
var DebugFlag = &cli.BoolFlag{
Name: "debug",
Aliases: []string{"d"},
Value: false,
Destination: &Debug,
Usage: "Show DEBUG messages",
}
func newAbraApp(version, commit string) *cli.App {
app := &cli.App{
Name: "abra",
@ -66,7 +54,7 @@ func newAbraApp(version, commit string) *cli.App {
},
Flags: []cli.Flag{
VerboseFlag,
DebugFlag,
internal.DebugFlag,
internal.NoInputFlag,
},
Authors: []*cli.Author{
@ -80,7 +68,7 @@ func newAbraApp(version, commit string) *cli.App {
app.EnableBashCompletion = true
app.Before = func(c *cli.Context) error {
if Debug {
if internal.Debug {
logrus.SetLevel(logrus.DebugLevel)
logrus.SetFormatter(&logrus.TextFormatter{})
logrus.SetOutput(os.Stderr)

View File

@ -259,3 +259,15 @@ var HetznerCloudAPITokenFlag = &cli.StringFlag{
EnvVars: []string{"HCLOUD_TOKEN"},
Destination: &HetznerCloudAPIToken,
}
// Debug stores the variable from DebugFlag.
var Debug bool
// DebugFlag turns on/off verbose logging down to the DEBUG level.
var DebugFlag = &cli.BoolFlag{
Name: "debug",
Aliases: []string{"d"},
Value: false,
Destination: &Debug,
Usage: "Show DEBUG messages",
}