feat: print stack traces for errors when debugging

This commit is contained in:
2021-09-27 12:24:02 +02:00
parent 22c4d0d864
commit 857d12d23c
3 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"coopcloud.tech/abra/cli/catalogue"
"coopcloud.tech/abra/cli/recipe"
"coopcloud.tech/abra/cli/server"
logrus_stack "github.com/Gurpartap/logrus-stack"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
@ -76,6 +77,9 @@ func RunApp(version, commit string) {
app.Before = func(c *cli.Context) error {
if Debug {
logrus.SetLevel(logrus.DebugLevel)
logrus.SetFormatter(&logrus.TextFormatter{})
logrus.SetOutput(os.Stderr)
logrus.AddHook(logrus_stack.StandardHook())
}
return nil
}