mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
Merge pull request #267 from frol-kr/bugfix/issue-254-crushes-when-container-logs-opened
#254-handling-with-wrong-log-format
This commit is contained in:
commit
2b898fb216
@ -48,8 +48,14 @@ func (l *DockerLogs) Stream() chan models.Log {
|
||||
scanner := bufio.NewScanner(r)
|
||||
for scanner.Scan() {
|
||||
parts := strings.SplitN(scanner.Text(), " ", 2)
|
||||
ts := l.parseTime(parts[0])
|
||||
logCh <- models.Log{Timestamp: ts, Message: parts[1]}
|
||||
if len(parts) == 0 {
|
||||
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
Block a user