mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
common/loggers: Remove the ANSI color for the browser error version
This commit is contained in:
parent
acc14b4646
commit
93aa6261b4
2 changed files with 12 additions and 5 deletions
|
@ -104,7 +104,7 @@ func (c *commandeer) getErrorWithContext() interface{} {
|
||||||
|
|
||||||
m := make(map[string]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()
|
m["Version"] = hugoVersionString()
|
||||||
|
|
||||||
fe := herrors.UnwrapErrorWithFileContext(c.buildErr)
|
fe := herrors.UnwrapErrorWithFileContext(c.buildErr)
|
||||||
|
|
|
@ -42,14 +42,21 @@ type Logger struct {
|
||||||
ErrorCounter *jww.Counter
|
ErrorCounter *jww.Counter
|
||||||
|
|
||||||
// This is only set in server mode.
|
// 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.
|
// Reset resets the logger's internal state.
|
||||||
func (l *Logger) Reset() {
|
func (l *Logger) Reset() {
|
||||||
l.ErrorCounter.Reset()
|
l.ErrorCounter.Reset()
|
||||||
if l.Errors != nil {
|
if l.errors != nil {
|
||||||
l.Errors.Reset()
|
l.errors.Reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +115,7 @@ func newLogger(stdoutThreshold, logThreshold jww.Threshold, outHandle, logHandle
|
||||||
return &Logger{
|
return &Logger{
|
||||||
Notepad: jww.NewNotepad(stdoutThreshold, logThreshold, outHandle, logHandle, "", log.Ldate|log.Ltime, listeners...),
|
Notepad: jww.NewNotepad(stdoutThreshold, logThreshold, outHandle, logHandle, "", log.Ldate|log.Ltime, listeners...),
|
||||||
ErrorCounter: errorCounter,
|
ErrorCounter: errorCounter,
|
||||||
Errors: errorBuff,
|
errors: errorBuff,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue