AUTH-2810 added warn for backwards compatibility sake

This commit is contained in:
Dalton
2020-06-12 11:20:36 -05:00
committed by Adam Chalmers
parent acb7d604fd
commit 55acf7283c
6 changed files with 24 additions and 8 deletions

View File

@@ -2,8 +2,10 @@ package cliutil
import (
"fmt"
"log"
"github.com/cloudflare/cloudflared/logger"
"github.com/pkg/errors"
"gopkg.in/urfave/cli.v2"
)
@@ -39,3 +41,15 @@ func ErrorHandler(actionFunc cli.ActionFunc) cli.ActionFunc {
return err
}
}
// PrintLoggerSetupError returns an error to stdout to notify when a logger can't start
func PrintLoggerSetupError(msg string, err error) error {
l, le := logger.New()
if le != nil {
log.Printf("%s: %s", msg, err)
} else {
l.Errorf("%s: %s", msg, err)
}
return errors.Wrap(err, msg)
}