job source: use task logger

This commit is contained in:
Christian Schwarz 2018-02-15 23:51:57 +01:00
parent 24b29a0865
commit 921bccb960

View File

@ -136,11 +136,9 @@ func (j *SourceJob) Pruner(task *Task, side PrunePolicySide, dryRun bool) (p Pru
func (j *SourceJob) serve(ctx context.Context, task *Task) { func (j *SourceJob) serve(ctx context.Context, task *Task) {
log := ctx.Value(contextKeyLog).(Logger)
listener, err := j.Serve.Listen() listener, err := j.Serve.Listen()
if err != nil { if err != nil {
log.WithError(err).Error("error listening") task.Log().WithError(err).Error("error listening")
return return
} }
@ -169,14 +167,14 @@ outer:
case rwcMsg := <-rwcChan: case rwcMsg := <-rwcChan:
if rwcMsg.err != nil { if rwcMsg.err != nil {
log.WithError(err).Error("error accepting connection") task.Log().WithError(err).Error("error accepting connection")
break outer break outer
} }
j.handleConnection(rwcMsg.rwc, task) j.handleConnection(rwcMsg.rwc, task)
case <-ctx.Done(): case <-ctx.Done():
log.WithError(ctx.Err()).Info("context") task.Log().WithError(ctx.Err()).Info("context")
break outer break outer
} }
@ -187,7 +185,7 @@ outer:
defer task.Finish() defer task.Finish()
err = listener.Close() err = listener.Close()
if err != nil { if err != nil {
log.WithError(err).Error("error closing listener") task.Log().WithError(err).Error("error closing listener")
} }
return return