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 { if ex, err := exists(fpath); err != nil {
return nil, err return nil, err
} else if !ex { } 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 // 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 { if s.PID.ID != thisPID.ID {
// trying to update when it's already been switched out, ignore // 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 return
} }

View File

@ -2,6 +2,7 @@ package service
import ( import (
"context" "context"
"io"
"sync" "sync"
"github.com/micro/go-micro/v2/client" "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{} record := pb.LogRecord{}
err := ls.RecvMsg(&record) err := ls.RecvMsg(&record)
if err != nil { if err != nil {
if err != io.EOF {
logStream.err = err
}
logStream.Stop() logStream.Stop()
return return
} }