Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2 from utilitywarehouse/fix-log-print
Browse files Browse the repository at this point in the history
Fmt prints
  • Loading branch information
ffilippopoulos committed Jan 17, 2020
2 parents 618eaf4 + 1d5ebae commit 0f58cbb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions kube/namespace_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func (nw *namespaceWatcher) eventHandler(eventType watch.EventType, old *v1.Name
case watch.Added, watch.Modified, watch.Deleted:
nw.updateNamespaceMetrics()
default:
fmt.Printf("[Info] Unknown namespace event received: %v", eventType)
fmt.Println(
fmt.Sprintf(
"[Info] Unknown namespace event received: %v",
eventType,
),
)
}
}

Expand All @@ -67,14 +72,14 @@ func (nw *namespaceWatcher) Start() {
}
store, controller := cache.NewInformer(listWatch, &v1.Namespace{}, nw.resyncPeriod, eventHandler)
nw.store = store
fmt.Printf("[Info] Starting namespace watcher")
fmt.Println("[Info] Starting namespace watcher")
// Running controller will block until writing on the stop channel.
controller.Run(nw.stopChannel)
fmt.Printf("[Info] Stopped namespace watcher")
fmt.Println("[Info] Stopped namespace watcher")
}

func (nw *namespaceWatcher) Stop() {
fmt.Printf("[Info] Stopping namespace watcher")
fmt.Println("[Info] Stopping namespace watcher")
close(nw.stopChannel)
}

Expand All @@ -83,7 +88,12 @@ func (nw *namespaceWatcher) List() []v1.Namespace {
for _, obj := range nw.store.List() {
ns, ok := obj.(*v1.Namespace)
if !ok {
fmt.Printf("[Error] Cannot read namespace object: %s", obj)
fmt.Println(
fmt.Sprintf(
"[Error] Cannot read namespace object: %s",
obj,
),
)
continue
}
nsList = append(nsList, *ns)
Expand Down

0 comments on commit 0f58cbb

Please sign in to comment.