diff --git a/.github/go/Dockerfile b/.github/go/Dockerfile index b6dccd6..0a7beb6 100644 --- a/.github/go/Dockerfile +++ b/.github/go/Dockerfile @@ -1 +1 @@ -FROM golang:1.20.1 +FROM golang:1.20.2 diff --git a/internal/server/data/resource.go b/internal/server/data/resource.go index 2cbe6f3..744b2a8 100644 --- a/internal/server/data/resource.go +++ b/internal/server/data/resource.go @@ -22,6 +22,7 @@ import ( "net/http" "net/textproto" "strconv" + "strings" "github.com/BBVA/kapow/internal/logger" "github.com/BBVA/kapow/internal/server/httperror" @@ -248,8 +249,18 @@ func setServerLog(w http.ResponseWriter, r *http.Request, h *model.Handler) { } handlerId := mux.Vars(r)["handlerID"] if prefix := mux.Vars(r)["prefix"]; prefix == "" { - logger.L.Printf("%s %s\n", handlerId, msg) + logger.L.Printf("%s %s\n", escapeString(handlerId), msg) } else { - logger.L.Printf("%s %s: %s\n", handlerId, prefix, msg) + logger.L.Printf("%s %s: %s\n", escapeString(handlerId), escapeString(prefix), msg) } } + +// function to scape strings in order to be printed in a Log +func escapeString(s string) string { + s = strings.Replace(s, "\n", "", -1) + s = strings.Replace(s, "\r", "", -1) + s = strings.Replace(s, "\t", "", -1) + s = strings.Replace(s, "\b", "", -1) + + return s +}