summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-21 14:11:27 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-06-21 14:11:27 +0200
commitf4ba433b1838c08a37bb2a2d32183f38e8763d64 (patch)
tree881a7a5f979423a497907c12af8bc3c4e7efa885 /libpod
parent9ec4d04592a7a7a833e4eefbe14e77af2da1f92d (diff)
downloadpodman-f4ba433b1838c08a37bb2a2d32183f38e8763d64.tar.gz
podman-f4ba433b1838c08a37bb2a2d32183f38e8763d64.tar.bz2
podman-f4ba433b1838c08a37bb2a2d32183f38e8763d64.zip
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>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_log.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/libpod/container_log.go b/libpod/container_log.go
index a30e4f5cc..8bbb7ebe8 100644
--- a/libpod/container_log.go
+++ b/libpod/container_log.go
@@ -74,7 +74,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
}
nll, err := logs.NewLogLine(line.Text)
if err != nil {
- logrus.Error(err)
+ logrus.Errorf("Error getting new log line: %v", err)
continue
}
if nll.Partial() {
@@ -100,10 +100,10 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
// read the file until EOF.
tailError := t.StopAtEOF()
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 {
- logrus.Error(err)
+ if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
+ logrus.Errorf("Error getting container state: %v", err)
}
return nil
}
@@ -126,7 +126,7 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
<-eventChannel
tailError := t.StopAtEOF()
if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" {
- logrus.Error(tailError)
+ logrus.Errorf("Error stopping logger: %v", tailError)
}
}()
}