Use context logging more to ensure context vars are present in log lines (#1039)

This commit is contained in:
Owen Cliffe
2018-06-06 15:14:29 +01:00
committed by Reed Allman
parent 19bc5cf852
commit c6abc8bf64
8 changed files with 56 additions and 42 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/fnproject/fn/api/models"
"github.com/fnproject/fn/api/common"
"github.com/sirupsen/logrus"
)
@@ -26,10 +27,11 @@ func NewNaivePlacer() Placer {
func (sp *naivePlacer) PlaceCall(rp RunnerPool, ctx context.Context, call RunnerCall) error {
log := common.Logger(ctx)
for {
runners, err := rp.Runners(call)
if err != nil {
logrus.WithError(err).Error("Failed to find runners for call")
log.WithError(err).Error("Failed to find runners for call")
} else {
for j := 0; j < len(runners); j++ {
@@ -47,7 +49,7 @@ func (sp *naivePlacer) PlaceCall(rp RunnerPool, ctx context.Context, call Runner
tryCancel()
if err != nil && err != models.ErrCallTimeoutServerBusy {
logrus.WithError(err).Error("Failed during call placement")
log.WithError(err).Error("Failed during call placement")
}
if placed {
return err