mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Use local JSON log buffer in parseDockerJSONLog.
This commit is contained in:
		@@ -280,16 +280,14 @@ func parseCRILog(log []byte, msg *logMessage) error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// dockerJSONLog is the JSON log buffer used in parseDockerJSONLog.
 | 
					 | 
				
			||||||
var dockerJSONLog = &jsonlog.JSONLog{}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// parseDockerJSONLog parses logs in Docker JSON log format. Docker JSON log format
 | 
					// parseDockerJSONLog parses logs in Docker JSON log format. Docker JSON log format
 | 
				
			||||||
// example:
 | 
					// example:
 | 
				
			||||||
//   {"log":"content 1","stream":"stdout","time":"2016-10-20T18:39:20.57606443Z"}
 | 
					//   {"log":"content 1","stream":"stdout","time":"2016-10-20T18:39:20.57606443Z"}
 | 
				
			||||||
//   {"log":"content 2","stream":"stderr","time":"2016-10-20T18:39:20.57606444Z"}
 | 
					//   {"log":"content 2","stream":"stderr","time":"2016-10-20T18:39:20.57606444Z"}
 | 
				
			||||||
func parseDockerJSONLog(log []byte, msg *logMessage) error {
 | 
					func parseDockerJSONLog(log []byte, msg *logMessage) error {
 | 
				
			||||||
	dockerJSONLog.Reset()
 | 
						var l = &jsonlog.JSONLog{}
 | 
				
			||||||
	l := dockerJSONLog
 | 
						l.Reset()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: JSON decoding is fairly expensive, we should evaluate this.
 | 
						// TODO: JSON decoding is fairly expensive, we should evaluate this.
 | 
				
			||||||
	if err := json.Unmarshal(log, l); err != nil {
 | 
						if err := json.Unmarshal(log, l); err != nil {
 | 
				
			||||||
		return fmt.Errorf("failed with %v to unmarshal log %q", err, l)
 | 
							return fmt.Errorf("failed with %v to unmarshal log %q", err, l)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user