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

log: use prefix in std loggers #38275

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions pkg/util/log/clog.go
Original file line number Diff line number Diff line change
Expand Up @@ -1381,8 +1381,10 @@ func (lb logBridge) Write(b []byte) (n int, err error) {

// NewStdLogger creates a *stdLog.Logger that forwards messages to the
// CockroachDB logs with the specified severity.
func NewStdLogger(severity Severity) *stdLog.Logger {
return stdLog.New(logBridge(severity), "", stdLog.Lshortfile)
//
// The prefix appears at the beginning of each generated log line.
func NewStdLogger(severity Severity, prefix string) *stdLog.Logger {
return stdLog.New(logBridge(severity), prefix, stdLog.Lshortfile)
}

// setV computes and remembers the V level for a given PC
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/netutil/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func ListenAndServeGRPC(
return ln, nil
}

var httpLogger = log.NewStdLogger(log.Severity_ERROR)
var httpLogger = log.NewStdLogger(log.Severity_ERROR, "httpLogger")

// Server is a thin wrapper around http.Server. See MakeServer for more detail.
type Server struct {
Expand Down