mirror of https://github.com/bcicen/ctop.git
#254-handling-with-wrong-log-format
This commit is contained in:
parent
29f9abf35c
commit
99be3b979e
|
@ -48,8 +48,14 @@ func (l *DockerLogs) Stream() chan models.Log {
|
||||||
scanner := bufio.NewScanner(r)
|
scanner := bufio.NewScanner(r)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
parts := strings.SplitN(scanner.Text(), " ", 2)
|
parts := strings.SplitN(scanner.Text(), " ", 2)
|
||||||
ts := l.parseTime(parts[0])
|
if len(parts) == 0 {
|
||||||
logCh <- models.Log{Timestamp: ts, Message: parts[1]}
|
continue
|
||||||
|
}
|
||||||
|
if len(parts) < 2 {
|
||||||
|
logCh <- models.Log{Timestamp: l.parseTime(""), Message: parts[0]}
|
||||||
|
} else {
|
||||||
|
logCh <- models.Log{Timestamp: l.parseTime(parts[0]), Message: parts[1]}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue