Permalink
Browse files

common/loggers: Remove the ANSI color for the browser error version

  • Loading branch information...
bep committed Oct 24, 2018
1 parent acc14b4 commit 93aa6261b4fc8caa74afef97b6304ea35dfd7d0e
Showing with 12 additions and 5 deletions.
  1. +1 −1 commands/commandeer.go
  2. +11 −4 common/loggers/loggers.go
@@ -104,7 +104,7 @@ func (c *commandeer) getErrorWithContext() interface{} {
m := make(map[string]interface{})
m["Error"] = errors.New(removeErrorPrefixFromLog(c.logger.Errors.String()))
m["Error"] = errors.New(removeErrorPrefixFromLog(c.logger.Errors()))
m["Version"] = hugoVersionString()
fe := herrors.UnwrapErrorWithFileContext(c.buildErr)
@@ -42,14 +42,21 @@ type Logger struct {
ErrorCounter *jww.Counter
// This is only set in server mode.
Errors *bytes.Buffer
errors *bytes.Buffer
}
func (l *Logger) Errors() string {
if l.errors == nil {
return ""
}
return ansiColorRe.ReplaceAllString(l.errors.String(), "")
}
// Reset resets the logger's internal state.
func (l *Logger) Reset() {
l.ErrorCounter.Reset()
if l.Errors != nil {
l.Errors.Reset()
if l.errors != nil {
l.errors.Reset()
}
}
@@ -108,7 +115,7 @@ func newLogger(stdoutThreshold, logThreshold jww.Threshold, outHandle, logHandle
return &Logger{
Notepad: jww.NewNotepad(stdoutThreshold, logThreshold, outHandle, logHandle, "", log.Ldate|log.Ltime, listeners...),
ErrorCounter: errorCounter,
Errors: errorBuff,
errors: errorBuff,
}
}

0 comments on commit 93aa626

Please sign in to comment.