Removed Log Color Codes
Since the color codes were displayed in an inappropriate manner, removed them from all logs .
This commit is contained in:
parent
d0e989136e
commit
b9592ed31c
1 changed files with 2 additions and 17 deletions
|
@ -2,7 +2,7 @@ package elektronLogging
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/fatih/color"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
@ -12,20 +12,6 @@ type ElektronFormatter struct {
|
|||
TimestampFormat string
|
||||
}
|
||||
|
||||
func (f ElektronFormatter) getColor(entry *log.Entry) *color.Color {
|
||||
switch entry.Level {
|
||||
case log.InfoLevel:
|
||||
return color.New(color.FgGreen, color.Bold)
|
||||
case log.WarnLevel:
|
||||
return color.New(color.FgYellow, color.Bold)
|
||||
case log.ErrorLevel:
|
||||
return color.New(color.FgRed, color.Bold)
|
||||
case log.FatalLevel:
|
||||
return color.New(color.FgRed, color.Bold)
|
||||
default:
|
||||
return color.New(color.FgWhite, color.Bold)
|
||||
}
|
||||
}
|
||||
func (f ElektronFormatter) Format(entry *log.Entry) ([]byte, error) {
|
||||
var b *bytes.Buffer
|
||||
|
||||
|
@ -35,8 +21,7 @@ func (f ElektronFormatter) Format(entry *log.Entry) ([]byte, error) {
|
|||
b = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
levelColor := f.getColor(entry)
|
||||
level := levelColor.Sprintf("[%s]:", strings.ToUpper(entry.Level.String()))
|
||||
level := fmt.Sprintf("[%s]:", strings.ToUpper(entry.Level.String()))
|
||||
message := strings.Join([]string{level, entry.Time.Format(f.TimestampFormat), entry.Message, " "}, " ")
|
||||
|
||||
var formattedFields []string
|
||||
|
|
Reference in a new issue