Skip to content

Commit

Permalink
Add support to log console_logs at root level (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjyoti30 committed Feb 21, 2022
1 parent 4bd33c4 commit 8da3f17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/logs/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ type Response struct {
Headers map[string][]string
Took *float64 `json:"took,omitempty"`
Body string `json:"body"`
Console []string `json:"console,omitempty"`
}

type record struct {
Expand All @@ -98,6 +97,7 @@ type record struct {
RequestChanges []difference.Difference `json:"requestChanges"`
ResponseChanges []difference.Difference `json:"responseChanges"`
Timestamp time.Time `json:"timestamp"`
Console []string `json:"console_logs"`
}

// Recorder records a log "record" for every request.
Expand Down Expand Up @@ -284,7 +284,7 @@ func (l *Logs) recordResponse(w *httptest.ResponseRecorder, r *http.Request, req
if err != nil {
log.Warnln(logTag, "couldn't extract console logs, ", err)
} else {
rec.Response.Console = *consoleStr
rec.Console = *consoleStr
}

marshalledLog, err := json.Marshal(rec)
Expand Down

0 comments on commit 8da3f17

Please sign in to comment.