(entry *logrus.Entry)
| 53 | type MineFormatter struct{} |
| 54 | |
| 55 | func (s *MineFormatter) Format(entry *logrus.Entry) ([]byte, error) { |
| 56 | detailInfo := "" |
| 57 | if entry.Caller != nil { |
| 58 | function := strings.ReplaceAll(entry.Caller.Function, "github.com/1Panel-dev/1Panel/core/", "") |
| 59 | detailInfo = fmt.Sprintf("(%s: %d)", function, entry.Caller.Line) |
| 60 | } |
| 61 | if len(entry.Data) == 0 { |
| 62 | msg := fmt.Sprintf("[%s] [%s] %s %s \n", time.Now().Format(TimeFormat), strings.ToUpper(entry.Level.String()), entry.Message, detailInfo) |
| 63 | return []byte(msg), nil |
| 64 | } |
| 65 | msg := fmt.Sprintf("[%s] [%s] %s %s {%v} \n", time.Now().Format(TimeFormat), strings.ToUpper(entry.Level.String()), entry.Message, detailInfo, entry.Data) |
| 66 | return []byte(msg), nil |
| 67 | } |
no test coverage detected