Skip to content

Commit 0513350

Browse files
authored
client: minor improvements to log messages (#8564)
Couple of minor improvements to log messages from the gRPC channel The improvements are: - Log the target URI when we log a message for the creation of a gRPC channel - Separate the channelz identifier (which could be something like `[Channel #X]` or `[Channel X][Subchannel Y]` etc) from the actual message being logged with a space RELEASE NOTES: none
1 parent ebaf486 commit 0513350

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clientconn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func (cc *ClientConn) validateTransportCredentials() error {
456456
func (cc *ClientConn) channelzRegistration(target string) {
457457
parentChannel, _ := cc.dopts.channelzParent.(*channelz.Channel)
458458
cc.channelz = channelz.RegisterChannel(parentChannel, target)
459-
cc.addTraceEvent("created")
459+
cc.addTraceEvent(fmt.Sprintf("created for target %q", target))
460460
}
461461

462462
// chainUnaryClientInterceptors chains all unary client interceptors into one.

internal/channelz/trace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func (r RefChannelType) String() string {
194194
// If channelz is not turned ON, this will simply log the event descriptions.
195195
func AddTraceEvent(l grpclog.DepthLoggerV2, e Entity, depth int, desc *TraceEvent) {
196196
// Log only the trace description associated with the bottom most entity.
197-
d := fmt.Sprintf("[%s]%s", e, desc.Desc)
197+
d := fmt.Sprintf("[%s] %s", e, desc.Desc)
198198
switch desc.Severity {
199199
case CtUnknown, CtInfo:
200200
l.InfoDepth(depth+1, d)

0 commit comments

Comments
 (0)