mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	Merge pull request #1853 from jedevc/logrus-show-error
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
package logutil
 | 
					package logutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -12,5 +13,11 @@ type Formatter struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
 | 
					func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
 | 
				
			||||||
	return []byte(fmt.Sprintf("%s: %s\n", strings.ToUpper(entry.Level.String()), entry.Message)), nil
 | 
						msg := bytes.NewBuffer(nil)
 | 
				
			||||||
 | 
						fmt.Fprintf(msg, "%s: %s", strings.ToUpper(entry.Level.String()), entry.Message)
 | 
				
			||||||
 | 
						if v, ok := entry.Data[logrus.ErrorKey]; ok {
 | 
				
			||||||
 | 
							fmt.Fprintf(msg, ": %v", v)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fmt.Fprintf(msg, "\n")
 | 
				
			||||||
 | 
						return msg.Bytes(), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user