Upgrade google.golang.org/grpc and google.golang.org/protobuf
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
		
							
								
								
									
										28
									
								
								vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -48,7 +48,11 @@ func (g *callIDGenerator) reset() { | ||||
| var idGen callIDGenerator | ||||
|  | ||||
| // MethodLogger is the sub-logger for each method. | ||||
| type MethodLogger struct { | ||||
| type MethodLogger interface { | ||||
| 	Log(LogEntryConfig) | ||||
| } | ||||
|  | ||||
| type methodLogger struct { | ||||
| 	headerMaxLen, messageMaxLen uint64 | ||||
|  | ||||
| 	callID          uint64 | ||||
| @@ -57,8 +61,8 @@ type MethodLogger struct { | ||||
| 	sink Sink // TODO(blog): make this plugable. | ||||
| } | ||||
|  | ||||
| func newMethodLogger(h, m uint64) *MethodLogger { | ||||
| 	return &MethodLogger{ | ||||
| func newMethodLogger(h, m uint64) *methodLogger { | ||||
| 	return &methodLogger{ | ||||
| 		headerMaxLen:  h, | ||||
| 		messageMaxLen: m, | ||||
|  | ||||
| @@ -69,8 +73,10 @@ func newMethodLogger(h, m uint64) *MethodLogger { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Log creates a proto binary log entry, and logs it to the sink. | ||||
| func (ml *MethodLogger) Log(c LogEntryConfig) { | ||||
| // Build is an internal only method for building the proto message out of the | ||||
| // input event. It's made public to enable other library to reuse as much logic | ||||
| // in methodLogger as possible. | ||||
| func (ml *methodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry { | ||||
| 	m := c.toProto() | ||||
| 	timestamp, _ := ptypes.TimestampProto(time.Now()) | ||||
| 	m.Timestamp = timestamp | ||||
| @@ -85,11 +91,15 @@ func (ml *MethodLogger) Log(c LogEntryConfig) { | ||||
| 	case *pb.GrpcLogEntry_Message: | ||||
| 		m.PayloadTruncated = ml.truncateMessage(pay.Message) | ||||
| 	} | ||||
|  | ||||
| 	ml.sink.Write(m) | ||||
| 	return m | ||||
| } | ||||
|  | ||||
| func (ml *MethodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| // Log creates a proto binary log entry, and logs it to the sink. | ||||
| func (ml *methodLogger) Log(c LogEntryConfig) { | ||||
| 	ml.sink.Write(ml.Build(c)) | ||||
| } | ||||
|  | ||||
| func (ml *methodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| 	if ml.headerMaxLen == maxUInt { | ||||
| 		return false | ||||
| 	} | ||||
| @@ -119,7 +129,7 @@ func (ml *MethodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| 	return truncated | ||||
| } | ||||
|  | ||||
| func (ml *MethodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) { | ||||
| func (ml *methodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) { | ||||
| 	if ml.messageMaxLen == maxUInt { | ||||
| 		return false | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kazuyoshi Kato
					Kazuyoshi Kato