Skip to content

Commit

Permalink
ctlv3: update logger for snapshot command
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Apr 6, 2018
1 parent bf47197 commit 18b1d1f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions etcdctl/ctlv3/command/snapshot_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"path/filepath"
"strings"

"github.com/coreos/etcd/pkg/logutil"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/snapshot"

"github.com/spf13/cobra"
"go.uber.org/zap"
)

const (
Expand Down Expand Up @@ -96,13 +96,13 @@ func snapshotSaveCommandFunc(cmd *cobra.Command, args []string) {
ExitWithError(ExitBadArgs, err)
}

lg := logutil.NewDiscardLogger()
debug, err := cmd.Flags().GetBool("debug")
if err != nil {
ExitWithError(ExitError, err)
}
lg := zap.NewNop()
if debug {
lg = logutil.NewPackageLogger("github.com/coreos/etcd", "snapshot")
lg = zap.NewExample()
}
sp := snapshot.NewV3(mustClientFromCmd(cmd), lg)

Expand All @@ -120,13 +120,13 @@ func snapshotStatusCommandFunc(cmd *cobra.Command, args []string) {
}
initDisplayFromCmd(cmd)

lg := logutil.NewDiscardLogger()
debug, err := cmd.Flags().GetBool("debug")
if err != nil {
ExitWithError(ExitError, err)
}
lg := zap.NewNop()
if debug {
lg = logutil.NewPackageLogger("github.com/coreos/etcd", "snapshot")
lg = zap.NewExample()
}
sp := snapshot.NewV3(nil, lg)

Expand Down Expand Up @@ -158,13 +158,13 @@ func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) {
walDir = filepath.Join(dataDir, "member", "wal")
}

lg := logutil.NewDiscardLogger()
debug, err := cmd.Flags().GetBool("debug")
if err != nil {
ExitWithError(ExitError, err)
}
lg := zap.NewNop()
if debug {
lg = logutil.NewPackageLogger("github.com/coreos/etcd", "snapshot")
lg = zap.NewExample()
}
sp := snapshot.NewV3(nil, lg)

Expand Down

0 comments on commit 18b1d1f

Please sign in to comment.