diff --git a/pkg/utils/fswatcher.go b/pkg/utils/fswatcher.go index 164381934..82bf58b06 100644 --- a/pkg/utils/fswatcher.go +++ b/pkg/utils/fswatcher.go @@ -94,9 +94,9 @@ func (w *FsWatcher) add(names ...string) error { for p := name; ; p = filepath.Dir(p) { if _, ok := w.paths[p]; !ok { if err := w.Add(p); err != nil { - klog.V(1).Infof("failed to add fsnotify watch for %q: %v", p, err) + klog.V(1).ErrorS(err, "failed to add fsnotify watch", "path", p) } else { - klog.V(1).Infof("added fsnotify watch %q", p) + klog.V(1).InfoS("added fsnotify watch", "path", p) added = true } @@ -124,14 +124,14 @@ func (w *FsWatcher) watch() { case e, ok := <-w.Watcher.Events: // Watcher has been closed if !ok { - klog.Infof("watcher closed") + klog.InfoS("watcher closed") return } // If any of our paths change name := filepath.Clean(e.Name) if _, ok := w.paths[filepath.Clean(name)]; ok { - klog.V(2).Infof("fsnotify %s event in %q detected", e, name) + klog.V(2).InfoS("fsnotify event detected", "path", name, "fsNotifyEvent", e) // Rate limiter. In certain filesystem operations we get // numerous events in quick succession @@ -141,15 +141,15 @@ func (w *FsWatcher) watch() { case e, ok := <-w.Watcher.Errors: // Watcher has been closed if !ok { - klog.Infof("watcher closed") + klog.InfoS("watcher closed") return } - klog.Warningf("fswatcher error event detected: %v", e) + klog.ErrorS(e, "fswatcher error event detected") case <-ratelimiter: // Blindly remove existing watch and add a new one if err := w.reset(w.names...); err != nil { - klog.Errorf("%v, re-trying in 60 seconds...", err) + klog.ErrorS(err, "re-trying in 60 seconds") ratelimiter = time.After(60 * time.Second) } diff --git a/pkg/utils/memory_resources.go b/pkg/utils/memory_resources.go index fa2eea0ca..c86ecb8eb 100644 --- a/pkg/utils/memory_resources.go +++ b/pkg/utils/memory_resources.go @@ -91,7 +91,7 @@ func getHugepagesBytes(path string) (MemoryResourceInfo, error) { for _, entry := range entries { split := strings.SplitN(entry.Name(), "-", 2) if len(split) != 2 || split[0] != "hugepages" { - klog.Warningf("malformed hugepages entry %q", entry.Name()) + klog.InfoS("malformed hugepages entry", "hugepagesEntry", entry.Name()) continue }