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
}
// JSONTraceRequest is a trace log request written to file
type JSONTraceRequest struct {
ID string `json:"id"`
URL string `json:"url"`
Error string `json:"error"`
Type string `json:"type"`
// JSONLogRequest is a trace/error log request written to file
type JSONLogRequest struct {
Template string `json:"template"`
Input string `json:"input"`
Error string `json:"error"`
Type string `json:"type"`
}
// 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 {
return
}
request := &JSONTraceRequest{
ID: templateID,
URL: url,
Type: requestType,
request := &JSONLogRequest{
Template: templatePath,
Input: input,
Type: requestType,
}
if requestErr != nil {
request.Error = requestErr.Error()