logs-fix-14
This commit is contained in:
parent
3502d8b3d1
commit
11472d5b06
|
@ -1,10 +1,24 @@
|
||||||
|
package logs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LogTextFormatter struct {
|
||||||
|
logrus.Formatter
|
||||||
|
}
|
||||||
|
|
||||||
func (u LogTextFormatter) Format(e *logrus.Entry) ([]byte, error) {
|
func (u LogTextFormatter) Format(e *logrus.Entry) ([]byte, error) {
|
||||||
level := strings.ToUpper(e.Level.String())
|
level := strings.ToUpper(e.Level.String())
|
||||||
message := e.Message
|
message := e.Message
|
||||||
parts := strings.SplitN(message, " +0000]", 2)
|
parts := strings.SplitN(message, " +0000]", 2)
|
||||||
if len(parts) >= 2 {
|
if len(parts) >= 2 {
|
||||||
message = parts[1]
|
message = parts[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
var color string
|
var color string
|
||||||
switch e.Level {
|
switch e.Level {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user