Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshot: use structured logger #9538

Merged
merged 2 commits into from
Apr 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ctlv3: update logger for snapshot command
Signed-off-by: Gyuho Lee <[email protected]>
gyuho committed Apr 6, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 18b1d1ff6577228f90b48847f79cb100fcf33ca2
14 changes: 7 additions & 7 deletions etcdctl/ctlv3/command/snapshot_command.go
Original file line number Diff line number Diff line change
@@ -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 (
@@ -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)

@@ -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)

@@ -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)