mirror of
https://github.com/containers/podman.git
synced 2025-10-19 04:03:23 +08:00
logs: k8s-file: fix spurious error logs
Fix the suprious "Error: nil" messages. Also add some more context to logged error messages which makes error sources more obvious. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -74,7 +74,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
|
|||||||
}
|
}
|
||||||
nll, err := logs.NewLogLine(line.Text)
|
nll, err := logs.NewLogLine(line.Text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Errorf("Error getting new log line: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if nll.Partial() {
|
if nll.Partial() {
|
||||||
@ -100,10 +100,10 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
|
|||||||
// read the file until EOF.
|
// read the file until EOF.
|
||||||
tailError := t.StopAtEOF()
|
tailError := t.StopAtEOF()
|
||||||
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
|
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
|
||||||
logrus.Error(tailError)
|
logrus.Errorf("Error stopping logger: %v", tailError)
|
||||||
}
|
}
|
||||||
if errors.Cause(err) != define.ErrNoSuchCtr {
|
if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
|
||||||
logrus.Error(err)
|
logrus.Errorf("Error getting container state: %v", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
|
|||||||
<-eventChannel
|
<-eventChannel
|
||||||
tailError := t.StopAtEOF()
|
tailError := t.StopAtEOF()
|
||||||
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
|
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
|
||||||
logrus.Error(tailError)
|
logrus.Errorf("Error stopping logger: %v", tailError)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user