Skip to content
Snippets Groups Projects
Commit c310bf62 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Logger: Format json body

parent c5a355da
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,6 @@ import (
"os"
"reflect"
"regexp"
"runtime"
"strings"
"github.com/MindscapeHQ/raygun4go"
......@@ -380,6 +379,12 @@ func (f *CustomLogFormatter) Format(entry *log.Entry) ([]byte, error) {
data["msg"] = entry.Message
}
if value, ok := data["body"].(string); ok {
cleanValue := strings.ReplaceAll(value, "\n", "")
cleanValue = strings.ReplaceAll(cleanValue, "\"", "'")
data["body"] = cleanValue
}
var b *bytes.Buffer
if entry.Buffer != nil {
b = entry.Buffer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment