Skip to content

Commit d5465d4

Browse files
committed
Update logger error formatting
1 parent ffb0d04 commit d5465d4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

golang-coprocessor/internal/requests.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) {
6565

6666
cr, err := HandleRequest(w, r)
6767
if err != nil {
68-
logger.Error(err, "error handling coprocessor request")
69-
http.Error(w, fmt.Sprintf("error: %s", err), http.StatusInternalServerError)
68+
logger.Error(err, "Error handling coprocessor request")
69+
http.Error(w, fmt.Sprintf("Error: %s", err), http.StatusInternalServerError)
7070
return
7171
}
7272

7373
response, err = json.Marshal(&cr)
7474
if err != nil {
75-
logger.Error(err, "failed to marshal response")
76-
http.Error(w, fmt.Sprintf("failed to marshal response: %s", err), http.StatusInternalServerError)
75+
logger.Error(err, "Failed to marshal response")
76+
http.Error(w, fmt.Sprintf("Failed to marshal response: %s", err), http.StatusInternalServerError)
7777
return
7878
}
7979

8080
_, err = w.Write(response)
8181
if err != nil {
82-
logger.Error(err, "error writing coprocessor response")
83-
http.Error(w, fmt.Sprintf("error: %s", err), http.StatusInternalServerError)
82+
logger.Error(err, "Error writing coprocessor response")
83+
http.Error(w, fmt.Sprintf("Error: %s", err), http.StatusInternalServerError)
8484
return
8585
}
8686
}

golang-coprocessor/internal/stages_router.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (rr *RouterRequest) UnmarshalJSON(data []byte) error {
5353
// Additionally, I'm not sure there's a way to cause an error in unit tests when decoding to a
5454
// json.RawMessage value.
5555
if err = json.Unmarshal(data, &rrb); err != nil {
56-
logger.Error(err, "failed to unmarshal body")
56+
logger.Error(err, "Failed to unmarshal body")
5757
}
5858

5959
if len(rrb.Body) > 0 {
@@ -101,7 +101,7 @@ func (rr *RouterRequest) MarshalJSON() ([]byte, error) {
101101
jsonBody, err = json.Marshal(rr.Body)
102102

103103
if err != nil {
104-
logger.Error(err, "failed to marshal coprocessor request struct: %v")
104+
logger.Error(err, "Failed to marshal coprocessor request struct: %v")
105105
}
106106

107107
routerRequestBodyOverride.Body = string(jsonBody)
@@ -149,7 +149,7 @@ func (rr *RouterResponse) UnmarshalJSON(data []byte) error {
149149
// Additionally, I'm not sure there's a way to cause an error in unit tests when decoding to a
150150
// json.RawMessage value.
151151
if err = json.Unmarshal(data, &rrb); err != nil {
152-
logger.Error(err, "failed to unmarshal body")
152+
logger.Error(err, "Failed to unmarshal body")
153153
}
154154

155155
if len(rrb.Body) > 0 {
@@ -198,7 +198,7 @@ func (rr *RouterResponse) MarshalJSON() ([]byte, error) {
198198
jsonBody, err = json.Marshal(rr.Body)
199199

200200
if err != nil {
201-
logger.Error(err, "failed to marshal coprocessor request struct: %v")
201+
logger.Error(err, "Failed to marshal coprocessor request struct: %v")
202202
}
203203

204204
routerRequestBodyOverride.Body = string(jsonBody)
@@ -219,7 +219,7 @@ func handleRouterRequest(httpRequestBody *[]byte) (*RouterRequest, error) {
219219
requestBody, err := json.Marshal(cr)
220220

221221
if err != nil {
222-
logger.Error(err, "failed to marshal coprocessor request struct: %v")
222+
logger.Error(err, "Failed to marshal coprocessor request struct: %v")
223223
}
224224

225225
// This is the object sent by the Router that you can act upon to update headers, context, auth claims, etc

0 commit comments

Comments
 (0)