in grpc/server/ctxlogger/ctxlogger.go [116:137]
func FilterLogs(req any) map[string]interface{} {
in, ok := req.(proto.Message)
var reqPayload map[string]interface{}
if ok {
// Get the protoreflect.Message interface for the message
message := in.ProtoReflect()
// Marshal the message to JSON bytes
jsonBytes, err := protojson.Marshal(message.Interface().(protoreflect.ProtoMessage))
if err != nil {
log.Error(err.Error())
}
// Unmarshal the JSON bytes to a map[string]interface{}
err = json.Unmarshal(jsonBytes, &reqPayload)
if err != nil {
log.Error(err.Error())
}
// Filter out the fields that are not loggable using the helper function
reqPayload = filterLoggableFields(reqPayload, message)
}
return reqPayload
}