diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-12 11:43:20 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-14 13:40:56 +0200 |
commit | 5c96bda70a7afb2ce97cbb3cd70c64fc8cb94446 (patch) | |
tree | 394a557b0dc7db1f6753cf2a09e8cb0577f18442 /common/loggers/loggers.go | |
parent | 4a96df96d958a8ce122f103c4b417eaba52e6cb1 (diff) |
errors: Misc improvements
* Redo the server error template
* Always add the content file context if relevant
* Remove some now superflous error string matching
* Move the server error template to _server/error.html
* Add file context (with position) to codeblock render blocks
* Improve JS build errors
Fixes #9892
Fixes #9891
Fixes #9893
Diffstat (limited to 'common/loggers/loggers.go')
-rw-r--r-- | common/loggers/loggers.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/loggers/loggers.go b/common/loggers/loggers.go index 14c76ae45..c61c55a67 100644 --- a/common/loggers/loggers.go +++ b/common/loggers/loggers.go @@ -240,6 +240,11 @@ func NewBasicLoggerForWriter(t jww.Threshold, w io.Writer) Logger { return newLogger(t, jww.LevelError, w, ioutil.Discard, false) } +// RemoveANSIColours removes all ANSI colours from the given string. +func RemoveANSIColours(s string) string { + return ansiColorRe.ReplaceAllString(s, "") +} + var ( ansiColorRe = regexp.MustCompile("(?s)\\033\\[\\d*(;\\d*)*m") errorRe = regexp.MustCompile("^(ERROR|FATAL|WARN)") |