mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 04:57:59 +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.Total = res["totalLinesWritten"].(int32)
|
||||
if res["totalLinesWritten"] != nil {
|
||||
result.Total = res["totalLinesWritten"].(int32)
|
||||
} else {
|
||||
result.Total = 0
|
||||
}
|
||||
|
||||
result.Logs = make([]string, 0)
|
||||
|
||||
for _, v := range res["log"].(bson.A) {
|
||||
result.Logs = append(result.Logs, v.(string))
|
||||
switch res["log"].(type) {
|
||||
case bson.A:
|
||||
for _, v := range res["log"].(bson.A) {
|
||||
result.Logs = append(result.Logs, v.(string))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user