diff --git a/tailer/fswatcher/fseventProducerLoop_darwin.go b/tailer/fswatcher/fseventProducerLoop_darwin.go index 3d7bce43..34f24247 100644 --- a/tailer/fswatcher/fseventProducerLoop_darwin.go +++ b/tailer/fswatcher/fseventProducerLoop_darwin.go @@ -26,8 +26,6 @@ type keventloop struct { done chan struct{} } -type Kevent syscall.Kevent_t - // Terminate the kevent loop. // If the loop hangs in syscall.Kevent(), it will keep hanging there until the next event is read. // Therefore, after the consumer called Close(), it should interrupt the kevent() call by closing the kq descriptor. @@ -86,7 +84,7 @@ func runKeventLoop(kq int) *keventloop { return result } -func (event Kevent) String() string { +func event2string(event syscall.Kevent_t) string { result := make([]string, 0, 1) if event.Fflags&syscall.NOTE_DELETE == syscall.NOTE_DELETE { result = append(result, "NOTE_DELETE") diff --git a/tailer/fswatcher/fswatcher_darwin.go b/tailer/fswatcher/fswatcher_darwin.go index 875bf246..43639e06 100644 --- a/tailer/fswatcher/fswatcher_darwin.go +++ b/tailer/fswatcher/fswatcher_darwin.go @@ -120,20 +120,20 @@ func (w *watcher) processEvent(t *fileTailer, event fsevent, log logrus.FieldLog for _, dir = range t.watchedDirs { if kevent.Ident == fdToInt(dir.file.Fd()) { dirLogger = log.WithField("directory", dir.file.Name()) - dirLogger.Debugf("dir event: %v", kevent) + dirLogger.Debugf("dir event: %v", event2string(kevent)) return w.processDirEvent(t, kevent, dir, dirLogger) } } for _, file = range t.watchedFiles { if kevent.Ident == fdToInt(file.file.Fd()) { fileLogger = log.WithField("file", file.file.Name()).WithField("fd", file.file.Fd()) - fileLogger.Debugf("file event: %v", kevent) + fileLogger.Debugf("file event: %v", event2string(kevent)) return w.processFileEvent(t, kevent, file, fileLogger) } } // Events for unknown file descriptors are ignored. This might happen if syncFilesInDir() already // closed a file while a pending event is still coming in. - log.Debugf("event for unknown file descriptor %v: %v", kevent.Ident, kevent) + log.Debugf("event for unknown file descriptor %v: %v", kevent.Ident, event2string(kevent)) return nil }