Bump grpc to v1.50.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
This commit is contained in:
		
							
								
								
									
										19
									
								
								vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -52,7 +52,9 @@ type MethodLogger interface { | ||||
| 	Log(LogEntryConfig) | ||||
| } | ||||
|  | ||||
| type methodLogger struct { | ||||
| // TruncatingMethodLogger is a method logger that truncates headers and messages | ||||
| // based on configured fields. | ||||
| type TruncatingMethodLogger struct { | ||||
| 	headerMaxLen, messageMaxLen uint64 | ||||
|  | ||||
| 	callID          uint64 | ||||
| @@ -61,8 +63,9 @@ type methodLogger struct { | ||||
| 	sink Sink // TODO(blog): make this plugable. | ||||
| } | ||||
|  | ||||
| func newMethodLogger(h, m uint64) *methodLogger { | ||||
| 	return &methodLogger{ | ||||
| // NewTruncatingMethodLogger returns a new truncating method logger. | ||||
| func NewTruncatingMethodLogger(h, m uint64) *TruncatingMethodLogger { | ||||
| 	return &TruncatingMethodLogger{ | ||||
| 		headerMaxLen:  h, | ||||
| 		messageMaxLen: m, | ||||
|  | ||||
| @@ -75,8 +78,8 @@ func newMethodLogger(h, m uint64) *methodLogger { | ||||
|  | ||||
| // 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 { | ||||
| // in TruncatingMethodLogger as possible. | ||||
| func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry { | ||||
| 	m := c.toProto() | ||||
| 	timestamp, _ := ptypes.TimestampProto(time.Now()) | ||||
| 	m.Timestamp = timestamp | ||||
| @@ -95,11 +98,11 @@ func (ml *methodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry { | ||||
| } | ||||
|  | ||||
| // Log creates a proto binary log entry, and logs it to the sink. | ||||
| func (ml *methodLogger) Log(c LogEntryConfig) { | ||||
| func (ml *TruncatingMethodLogger) Log(c LogEntryConfig) { | ||||
| 	ml.sink.Write(ml.Build(c)) | ||||
| } | ||||
|  | ||||
| func (ml *methodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| func (ml *TruncatingMethodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| 	if ml.headerMaxLen == maxUInt { | ||||
| 		return false | ||||
| 	} | ||||
| @@ -129,7 +132,7 @@ func (ml *methodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) { | ||||
| 	return truncated | ||||
| } | ||||
|  | ||||
| func (ml *methodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) { | ||||
| func (ml *TruncatingMethodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) { | ||||
| 	if ml.messageMaxLen == maxUInt { | ||||
| 		return false | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Luca Comellini
					Luca Comellini