add logrus hook to log error file/line/function from stack traces

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2017-10-05 08:49:33 -07:00
parent 914165095a
commit 9ac71b03cc
3 changed files with 234 additions and 4 deletions
+6 -4
View File
@@ -56,6 +56,7 @@ import (
"github.com/heptio/ark/pkg/restore"
"github.com/heptio/ark/pkg/restore/restorers"
"github.com/heptio/ark/pkg/util/kube"
"github.com/heptio/ark/pkg/util/logging"
)
func NewCommand() *cobra.Command {
@@ -66,10 +67,11 @@ func NewCommand() *cobra.Command {
Short: "Run the ark server",
Long: "Run the ark server",
Run: func(c *cobra.Command, args []string) {
var (
logger = logrus.New()
s, err = newServer(kubeconfig, fmt.Sprintf("%s-%s", c.Parent().Name(), c.Name()), logger)
)
logger := logrus.New()
logger.Hooks.Add(&logging.ErrorLocationHook{})
s, err := newServer(kubeconfig, fmt.Sprintf("%s-%s", c.Parent().Name(), c.Name()), logger)
cmd.CheckError(err)
cmd.CheckError(s.run())