diff --git a/server/egrpc/interceptor.go b/server/egrpc/interceptor.go index e2d22c57..01c2e68b 100644 --- a/server/egrpc/interceptor.go +++ b/server/egrpc/interceptor.go @@ -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 != "" {