Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvubk committed May 22, 2024
1 parent b31896d commit 7c4e602
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/tls"
"errors"
"fmt"
"os"
"slices"
"strings"

Expand Down Expand Up @@ -401,7 +400,7 @@ func GetLoggerFromCmd(cmd *cobra.Command) log.Logger {
v := cmd.Context().Value(corectx.LoggerContextKey)
logger, ok := v.(log.Logger)
if !ok {
return log.NewLogger(os.Stdout)
return log.NewLogger(cmd.OutOrStdout())
}
return logger
}
Expand Down
8 changes: 3 additions & 5 deletions core/context/server_context.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package context

type ServerContextKey string

const (
LoggerContextKey ServerContextKey = "server.logger"
ViperContextKey ServerContextKey = "server.viper"
var (
LoggerContextKey struct{}
ViperContextKey struct{}
)
2 changes: 1 addition & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func GetServerContextFromCmd(cmd *cobra.Command) *LegacyContext {
logger := v.(log.Logger)
serverCtx.Logger = logger
} else {
serverCtx.Logger = log.NewLogger(os.Stdout)
serverCtx.Logger = log.NewLogger(cmd.OutOrStdout())
}

return serverCtx
Expand Down

0 comments on commit 7c4e602

Please sign in to comment.