Skip to content

Commit

Permalink
add debug messages for watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryRomanov committed Oct 7, 2024
1 parent 90e7808 commit 1d28baf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugin/input/file/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,16 @@ func (w *watcher) notify(e notify.Event, path string) {
return
}

w.logger.Infof("notify %s %s", e, path)

for _, pattern := range w.paths.Exclude {
match, err := doublestar.PathMatch(pattern, path)
if err != nil {
w.logger.Fatalf("wrong paths exclude pattern %q: %s", pattern, err.Error())
return
}
if match {
w.logger.Infof("excluded %s by pattern %s", path, pattern)
return
}
}
Expand Down Expand Up @@ -183,8 +186,6 @@ check_file:
dirFilename = filepath.Dir(dirFilename)
}

w.logger.Infof("%s %s", e, path)

for _, pattern := range w.paths.Include {
match, err := doublestar.PathMatch(pattern, path)
if err != nil {
Expand All @@ -193,6 +194,7 @@ check_file:
}

if match {
w.logger.Infof("path %s matched by pattern %s", filename, pattern)
w.notifyFn(e, filename, stat)
}
}
Expand Down

0 comments on commit 1d28baf

Please sign in to comment.