mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Add log error handling
This commit is contained in:
parent
7a98a63866
commit
9c85259964
@ -26,11 +26,19 @@ func (a *App) HostLogs(hostKey, filter string) (result HostLogsResult) {
|
|||||||
result.Error = err.Error()
|
result.Error = err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Total = res["totalLinesWritten"].(int32)
|
if res["totalLinesWritten"] != nil {
|
||||||
|
result.Total = res["totalLinesWritten"].(int32)
|
||||||
|
} else {
|
||||||
|
result.Total = 0
|
||||||
|
}
|
||||||
|
|
||||||
result.Logs = make([]string, 0)
|
result.Logs = make([]string, 0)
|
||||||
|
|
||||||
for _, v := range res["log"].(bson.A) {
|
switch res["log"].(type) {
|
||||||
result.Logs = append(result.Logs, v.(string))
|
case bson.A:
|
||||||
|
for _, v := range res["log"].(bson.A) {
|
||||||
|
result.Logs = append(result.Logs, v.(string))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user