Skip to content

Commit

Permalink
check ctxStore in intcp
Browse files Browse the repository at this point in the history
  • Loading branch information
sevennt committed Jan 3, 2024
1 parent de69e7f commit ce7467d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/egrpc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ func (c *Container) defaultUnaryServerInterceptor() grpc.UnaryServerInterceptor
elog.FieldPeerIP(getPeerIP(ctx)),
)

skv, _ := ctx.Value(ctxStoreStruct{}).(*ctxStore)
skv, skvOk := ctx.Value(ctxStoreStruct{}).(*ctxStore)
for _, key := range loggerKeys {
if v, ok := skv.kvs[key]; ok {
if v, ok := skv.kvs[key]; skvOk && ok {
fields = append(fields, elog.Any(strings.ToLower(key), v))
}
if value := tools.ContextValue(ctx, key); value != "" {
Expand Down

0 comments on commit ce7467d

Please sign in to comment.