Update json log request format

dev
Alexey Zhuchkov 2021-10-30 12:46:26 +03:00
parent 3f1186da2b
commit 933ed2429d
1 changed files with 11 additions and 11 deletions

View File

@ -174,23 +174,23 @@ func (w *StandardWriter) Write(event *ResultEvent) error {
return nil return nil
} }
// JSONTraceRequest is a trace log request written to file // JSONLogRequest is a trace/error log request written to file
type JSONTraceRequest struct { type JSONLogRequest struct {
ID string `json:"id"` Template string `json:"template"`
URL string `json:"url"` Input string `json:"input"`
Error string `json:"error"` Error string `json:"error"`
Type string `json:"type"` Type string `json:"type"`
} }
// Request writes a log the requests trace log // Request writes a log the requests trace log
func (w *StandardWriter) Request(templateID, url, requestType string, requestErr error) { func (w *StandardWriter) Request(templatePath, input, requestType string, requestErr error) {
if w.traceFile == nil && w.errorFile == nil { if w.traceFile == nil && w.errorFile == nil {
return return
} }
request := &JSONTraceRequest{ request := &JSONLogRequest{
ID: templateID, Template: templatePath,
URL: url, Input: input,
Type: requestType, Type: requestType,
} }
if requestErr != nil { if requestErr != nil {
request.Error = requestErr.Error() request.Error = requestErr.Error()