report errors from log streaming (#1828)

This commit is contained in:
Dominic Wong 2020-07-13 17:35:23 +01:00 committed by GitHub
parent 07fbb06ed8
commit 7c5e3b0f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -342,7 +342,7 @@ func (r *runtime) Logs(s *Service, options ...LogsOption) (LogStream, error) {
if ex, err := exists(fpath); err != nil {
return nil, err
} else if !ex {
return nil, fmt.Errorf("Log file %v does not exists", fpath)
return nil, fmt.Errorf("Logs not found for service %s", s.Name)
}
// have to check file size to avoid too big of a seek

View File

@ -229,7 +229,7 @@ func (s *service) Wait() {
if s.PID.ID != thisPID.ID {
// trying to update when it's already been switched out, ignore
logger.Warnf("Trying to update a process status but PID doesn't match. Old %s, New %s. Skipping update.", thisPID.ID, s.PID.ID)
logger.Debugf("Trying to update a process status but PID doesn't match. Old %s, New %s. Skipping update.", thisPID.ID, s.PID.ID)
return
}

View File

@ -2,6 +2,7 @@ package service
import (
"context"
"io"
"sync"
"github.com/micro/go-micro/v2/client"
@ -121,6 +122,9 @@ func (s *svc) Logs(service *runtime.Service, opts ...runtime.LogsOption) (runtim
record := pb.LogRecord{}
err := ls.RecvMsg(&record)
if err != nil {
if err != io.EOF {
logStream.err = err
}
logStream.Stop()
return
}