mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 23:32:02 +00:00
output from enrolling in ziti-tunnel should be nicer too
This commit is contained in:
@@ -66,6 +66,8 @@ func init() {
|
||||
}
|
||||
|
||||
var enrollSubCmd = &cobra.Command{
|
||||
SilenceErrors: true,
|
||||
SilenceUsage: true,
|
||||
Use: "enroll",
|
||||
Short: "enroll an identity",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
@@ -74,6 +76,14 @@ var enrollSubCmd = &cobra.Command{
|
||||
}
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
//set the formatter for enrolling via ziti-tunnel
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
ForceColors: true,
|
||||
DisableTimestamp: true,
|
||||
TimestampFormat: "",
|
||||
PadLevelText: true,
|
||||
})
|
||||
logrus.SetReportCaller(false) // for enrolling don't bother with this
|
||||
return processEnrollment()
|
||||
},
|
||||
}
|
||||
@@ -135,7 +145,7 @@ func processEnrollment() error {
|
||||
encErr := enc.Encode(&conf)
|
||||
|
||||
if encErr == nil {
|
||||
fmt.Printf("enrolled successfully. identity file written to: %s", outpath)
|
||||
logrus.Errorf("enrolled successfully. identity file written to: %s", outpath)
|
||||
return nil
|
||||
} else {
|
||||
return fmt.Errorf("enrollment successful but the identity file was not able to be written to: %s [%s]", outpath, encErr)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package subcmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/edge/tunnel/dns"
|
||||
"github.com/openziti/edge/tunnel/entities"
|
||||
@@ -56,7 +55,7 @@ var logFormatter string
|
||||
|
||||
func Execute() {
|
||||
if err := root.Execute(); err != nil {
|
||||
fmt.Printf("error: %s", err)
|
||||
pfxlog.Logger().Errorf("error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user