Skip to content

Commit e7e37a0

Browse files
Added some watcher messages to verbose mode.
1 parent 843dd41 commit e7e37a0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

paxrat.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,9 @@ func runWatcher(watcher *inotify.Watcher, config *Config) {
404404
if ev.Mask == inotify.IN_CREATE {
405405
if _, ok := (*config).Settings[ev.Name]; ok {
406406
watcher.AddWatch(ev.Name, InotifyFlags)
407-
log.Printf("File created: %s\n", ev.Name)
407+
if verbosevar {
408+
log.Printf("File created: %s\n", ev.Name)
409+
}
408410
}
409411
// Catch directory creation events for non-existent directories in executable path
410412
} else if ev.Mask == (inotify.IN_CREATE | inotify.IN_ISDIR) {
@@ -415,7 +417,9 @@ func runWatcher(watcher *inotify.Watcher, config *Config) {
415417
}
416418
} else if ev.Mask == inotify.IN_DELETE_SELF || ev.Mask == inotify.IN_MOVE_SELF {
417419
if _, ok := (*config).Settings[ev.Name]; ok {
418-
log.Printf("File deleted: %s\n", ev.Name)
420+
if verbosevar {
421+
log.Printf("File deleted: %s\n", ev.Name)
422+
}
419423
parent := filepath.Dir(ev.Name)
420424
watcher.AddWatch(parent, InotifyDirFlags)
421425
continue
@@ -424,13 +428,16 @@ func runWatcher(watcher *inotify.Watcher, config *Config) {
424428
if _, ok := (*config).Settings[ev.Name]; ok {
425429
exists := pathExists(ev.Name)
426430
if !exists {
427-
log.Printf("File deleted: %s\n", ev.Name)
431+
if verbosevar {
432+
log.Printf("File deleted: %s\n", ev.Name)
433+
}
428434
parent := filepath.Dir(ev.Name)
429435
watcher.AddWatch(parent, InotifyDirFlags)
430436
continue
431437
} else {
432-
log.Printf("File attributes changed: %s\n", ev.Name)
433-
438+
if verbosevar {
439+
log.Printf("File attributes changed: %s\n", ev.Name)
440+
}
434441
}
435442
}
436443
}

0 commit comments

Comments
 (0)