Add suggestions to FatalLevel log messages

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-08-09 14:57:35 -04:00
parent 1f78446a6f
commit 4c2d66e7b4
2 changed files with 7 additions and 3 deletions

View File

@ -28,7 +28,8 @@ var configCmd = &cobra.Command{
}
if !keyExists {
logrus.WithFields(logrus.Fields{
"key": args[0],
"key": args[0],
"suggestions": "Try looking up the available configuration keys: psu config ls --keys",
}).Fatal("Unknown configuration key")
}

View File

@ -1,6 +1,8 @@
package cmd
import (
"fmt"
"github.com/greenled/portainer-stack-utils/client"
"github.com/greenled/portainer-stack-utils/common"
"github.com/sirupsen/logrus"
@ -82,8 +84,9 @@ var stackRemoveCmd = &cobra.Command{
}).Debug("Stack not found")
if viper.GetBool("stack.remove.strict") {
logrus.WithFields(logrus.Fields{
"stack": stackName,
"endpoint": endpointId,
"stack": stackName,
"endpoint": endpointId,
"suggestions": fmt.Sprintf("Try with a different endpoint: psu stack rm %s --endpoint ENDPOINT_ID", stackName),
}).Fatal("Stack does not exist")
}
default: