Skip to content

Commit

Permalink
Merge pull request #134 from abeaumont/feature/add-filename-to-reques…
Browse files Browse the repository at this point in the history
…t-log

daemon: Add filename to parse request log
  • Loading branch information
abeaumont authored Nov 28, 2017
2 parents 1390ea2 + 5ac721f commit 4fc2127
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions daemon/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (d *Service) Parse(req *sdk.ParseRequest) *sdk.ParseResponse {
start := time.Now()
defer func() {
resp.Elapsed = time.Since(start)
d.logResponse(resp.Status, req.Language, len(req.Content), resp.Elapsed)
d.logResponse(resp.Status, req.Filename, req.Language, len(req.Content), resp.Elapsed)
}()

if req.Content == "" {
Expand Down Expand Up @@ -56,8 +56,9 @@ func (d *Service) Parse(req *sdk.ParseRequest) *sdk.ParseResponse {
return resp
}

func (d *Service) logResponse(s sdk.Status, language string, size int, elapsed time.Duration) {
func (d *Service) logResponse(s sdk.Status, filename string, language string, size int, elapsed time.Duration) {
l := logrus.WithFields(logrus.Fields{
"filename": filename,
"language": language,
"elapsed": elapsed,
})
Expand All @@ -79,7 +80,7 @@ func (d *Service) NativeParse(req *sdk.NativeParseRequest) *sdk.NativeParseRespo
start := time.Now()
defer func() {
resp.Elapsed = time.Since(start)
d.logResponse(resp.Status, req.Language, len(req.Content), resp.Elapsed)
d.logResponse(resp.Status, req.Language, req.Language, len(req.Content), resp.Elapsed)
}()

if req.Content == "" {
Expand Down

0 comments on commit 4fc2127

Please sign in to comment.