Skip to content

Commit

Permalink
Fix logging for query creation on error (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwass authored Dec 15, 2020
1 parent c1cc0e4 commit 55a2aa2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/service/logging_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ func (mw loggingMiddleware) NewQuery(ctx context.Context, p kolide.QueryPayload)
loggedInUser = vc.Username()
}
defer func(begin time.Time) {
if query == nil {
_ = mw.loggerInfo(err).Log(
"method", "NewQuery",
"err", err,
"user", loggedInUser,
"took", time.Since(begin),
)
return
}
_ = mw.loggerInfo(err).Log(
"method", "NewQuery",
"err", err,
Expand Down

0 comments on commit 55a2aa2

Please sign in to comment.