mirror of https://github.com/knative/pkg.git
Log if the deserialized line is semi-normal. (#1939)
Right now they panic and we lose all the context.
This commit is contained in:
parent
b89ac2a632
commit
c9bac6be76
|
|
@ -205,6 +205,12 @@ func (s *namespaceSource) handleLine(l []byte, pod string) {
|
||||||
if site == "" {
|
if site == "" {
|
||||||
site = line.Caller
|
site = line.Caller
|
||||||
}
|
}
|
||||||
|
func() {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
logf("Invalid log format for pod %s: %s", pod, string(l))
|
||||||
|
}
|
||||||
|
}()
|
||||||
// E 15:04:05.000 webhook-699b7b668d-9smk2 [route-controller] [default/testroute-xyz] this is my message
|
// E 15:04:05.000 webhook-699b7b668d-9smk2 [route-controller] [default/testroute-xyz] this is my message
|
||||||
msg := fmt.Sprintf("%s %s %s [%s] [%s] %s",
|
msg := fmt.Sprintf("%s %s %s [%s] [%s] %s",
|
||||||
strings.ToUpper(string(line.Level[0])),
|
strings.ToUpper(string(line.Level[0])),
|
||||||
|
|
@ -219,6 +225,7 @@ func (s *namespaceSource) handleLine(l []byte, pod string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
logf(msg)
|
logf(msg)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue