Skip to content

Commit

Permalink
improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoAtGit committed Jan 16, 2024
1 parent a63849d commit 2f87df5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/engine/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func (c *Inspector) Inspect(
vuls, err := c.doRun(queryContext)

if err != nil {
fmt.Println()
sentryReport.ReportSentry(&sentryReport.Report{
Message: fmt.Sprintf("Inspector. query executed with error, query=%s", query.Metadata.Query),
Err: err,
Expand Down Expand Up @@ -371,13 +372,11 @@ func (c *Inspector) DecodeQueryResults(

vulnerabilities := make([]model.Vulnerability, 0, len(queryResultItems))
failedDetectLine := false
timeOut := false
for _, queryResultItem := range queryResultItems {
select {
case <-ctxTimeout.Done():
log.Err(ctxTimeout.Err()).Msgf(
"Timeout processing the results of the query: %s %s",
ctx.Query.Metadata.Platform,
ctx.Query.Metadata.Query)
timeOut = true
break
default:
vulnerability, err := c.vb(ctx, c.tracker, queryResultItem, c.detector)
Expand Down Expand Up @@ -425,6 +424,14 @@ func (c *Inspector) DecodeQueryResults(
}
}

if timeOut {
fmt.Println()
log.Err(ctxTimeout.Err()).Msgf(
"Timeout processing the results of the query: %s %s",
ctx.Query.Metadata.Platform,
ctx.Query.Metadata.Query)
}

if failedDetectLine {
c.tracker.FailedDetectLine()
}
Expand Down

0 comments on commit 2f87df5

Please sign in to comment.