mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package logutil
 | 
						|
 | 
						|
import (
 | 
						|
	"bytes"
 | 
						|
	"fmt"
 | 
						|
	"strings"
 | 
						|
 | 
						|
	"github.com/sirupsen/logrus"
 | 
						|
)
 | 
						|
 | 
						|
type Formatter struct {
 | 
						|
	logrus.TextFormatter
 | 
						|
}
 | 
						|
 | 
						|
func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
 | 
						|
	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
 | 
						|
}
 |