Skip to content

Commit

Permalink
issue 5212 timeout added to trace and error logs using ts switch (#5292)
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarintherocks authored Jun 14, 2024
1 parent 51b1d7c commit baf7e36
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,14 @@ func (w *StandardWriter) Write(event *ResultEvent) error {

// JSONLogRequest is a trace/error log request written to file
type JSONLogRequest struct {
Template string `json:"template"`
Type string `json:"type"`
Input string `json:"input"`
Address string `json:"address"`
Error string `json:"error"`
Kind string `json:"kind,omitempty"`
Attrs interface{} `json:"attrs,omitempty"`
Template string `json:"template"`
Type string `json:"type"`
Input string `json:"input"`
Timestamp *time.Time `json:"timestamp,omitempty"`
Address string `json:"address"`
Error string `json:"error"`
Kind string `json:"kind,omitempty"`
Attrs interface{} `json:"attrs,omitempty"`
}

// Request writes a log the requests trace log
Expand All @@ -323,6 +324,10 @@ func (w *StandardWriter) Request(templatePath, input, requestType string, reques
Input: input,
Type: requestType,
}
if w.timestamp {
ts := time.Now()
request.Timestamp = &ts
}
parsed, _ := urlutil.ParseAbsoluteURL(input, false)
if parsed != nil {
request.Address = parsed.Hostname()
Expand Down

0 comments on commit baf7e36

Please sign in to comment.