Skip to content

Commit

Permalink
Log all state changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertKrawitz committed Jan 25, 2019
1 parent 996fa19 commit 0f73be3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package event

import (
"encoding/json"
"fmt"
"net/http"
"sync"
"time"
Expand Down Expand Up @@ -120,6 +121,9 @@ func (s *store) Add(namespace, podname, description string) {
s.addCacheEntry(namespace, podname, logString)
}
}
s.addCacheEntry(namespace, podname, fmt.Sprintf(">>> %v %s -> %s\n", event.timestamp, lastEvent.description, event.description))
} else {
s.addCacheEntry(namespace, podname, fmt.Sprintf(">>> %v %s -> %s\n", event.timestamp, "(created)", event.description))
}
nsevents[podname] = append(nsevents[podname], event)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Run(store event.Store, client kubernetes.Interface, port uint16) {
namespace := vars["namespace"]
cachedLog, ok := store.GetCachedLog(namespace, podname)
if ok {
io.WriteString(w, fmt.Sprintf("(CACHED)\n\n%s", cachedLog))
io.WriteString(w, cachedLog)
}
if err := log.LogPod(client, w, namespace, podname); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 0f73be3

Please sign in to comment.