mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Refactor Logger (#13294)
Refactor Logger to make a logger interface and make it possible to wrap loggers for specific purposes. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		@@ -73,6 +73,16 @@ func (l Level) String() string {
 | 
			
		||||
	return "info"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Color returns the color string for this Level
 | 
			
		||||
func (l Level) Color() *[]byte {
 | 
			
		||||
	color, ok := levelToColor[l]
 | 
			
		||||
	if ok {
 | 
			
		||||
		return &(color)
 | 
			
		||||
	}
 | 
			
		||||
	none := levelToColor[NONE]
 | 
			
		||||
	return &none
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MarshalJSON takes a Level and turns it into text
 | 
			
		||||
func (l Level) MarshalJSON() ([]byte, error) {
 | 
			
		||||
	buffer := bytes.NewBufferString(`"`)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user