(err error)
| 1051 | var lineBreaksReplacer = strings.NewReplacer("\n\r", " ", "\n", " ") |
| 1052 | |
| 1053 | func (ac *AccessLog) getErrorText(err error) (text string) { // caller checks for nil. |
| 1054 | if errPanic, ok := context.IsErrPanicRecovery(err); ok { |
| 1055 | ac.Flush() // flush any buffered contents to be written to the output. |
| 1056 | |
| 1057 | switch ac.PanicLog { |
| 1058 | case LogHandler: |
| 1059 | text = errPanic.CurrentHandlerFileLine |
| 1060 | case LogCallers: |
| 1061 | text = strings.Join(errPanic.Callers, "\n") |
| 1062 | case LogStack: |
| 1063 | text = string(errPanic.Stack) |
| 1064 | } |
| 1065 | |
| 1066 | text = fmt.Sprintf("error(%v %s)", errPanic.Cause, text) |
| 1067 | } else { |
| 1068 | text = fmt.Sprintf("error(%s)", err.Error()) |
| 1069 | } |
| 1070 | |
| 1071 | if !ac.KeepMultiLineError { |
| 1072 | return lineBreaksReplacer.Replace(text) |
| 1073 | } |
| 1074 | |
| 1075 | return text |
| 1076 | } |
no test coverage detected