func NewEventReader(c Config) (EventProducer, error) {
	stream := &fsevents.EventStream{
		Paths: c.Paths,
		// NoDefer: Ignore Latency field and send events as fast as possible.
		//          Useful as latency has one second granularity.
		//
		// WatchRoot: Will send a notification when some element changes along
		// 			the path being watched (dir moved or deleted).
		//
		// FileEvents: Get events for files not just directories
		Flags: fsevents.NoDefer | fsevents.WatchRoot | fsevents.FileEvents,
	}

	// IgnoreSelf: Avoid infinite looping when auditbeat writes to a
	//			   watched directory. If specified tests won't work.
	if !underTest {
		stream.Flags |= fsevents.IgnoreSelf
	}

	var dirs []os.FileInfo
	if !c.Recursive {
		for _, path := range c.Paths {
			if info, err := getFileInfo(path); err == nil {
				dirs = append(dirs, info)
			} else {
				logp.Warn("%v failed to get file info for '%s': %v", logPrefix, path, err)
			}
		}
	}
	return &fsreader{
		stream:      stream,
		config:      c,
		eventC:      make(chan Event, 1),
		watchedDirs: dirs,
	}, nil
}
// NewEventReader creates a new EventProducer backed by FSEvents macOS facility.
NewEventReader creates a new EventProducer backed by FSEvents macOS facility.
// NewEventReader creates a new EventProducer backed by FSEvents macOS facility .
func NewEventReader(c Config) (EventProducer, error) {
	stream := &fsevents.EventStream{
		Paths: c.Paths,
		 WatchRoot: Will send a notification when some element changes along
		 			the path being watched (dir moved or deleted).
		 FileEvents: Get events for files not just directories
		Flags: fsevents.NoDefer | fsevents.WatchRoot | fsevents.FileEvents,
	}
	 IgnoreSelf: Avoid infinite looping when auditbeat writes to a
				   watched directory. If specified tests won't work.
	if !underTest {
		stream.Flags |= fsevents.IgnoreSelf
	}
	var dirs []os.FileInfo
	if !c.Recursive {
		for _, path := range c.Paths {
			if info, err := getFileInfo(path); err == nil {
				dirs = append(dirs, info)
			} else {
				logp.Warn("%v failed to get file info for '%s': %v", logPrefix, path, err)
			}
		}
	}
	return &fsreader{
		stream:      stream,
		config:      c,
		eventC:      make(chan Event, 1),
		watchedDirs: dirs,
	}, nil
}
func NewEventReader ( c Config ) ( EventProducer , error ) { stream := & fsevents . EventStream { Paths : c . Paths , Flags : fsevents . NoDefer | fsevents . WatchRoot | fsevents . FileEvents , } if ! underTest { stream . Flags |= fsevents . IgnoreSelf } var dirs [ ] os . FileInfo if ! c . Recursive { for _ , path := range c . Paths { if info , err := getFileInfo ( path ) ; err == nil { dirs = append ( dirs , info ) } else { logp . Warn ( " " , logPrefix , path , err ) } } } return & fsreader { stream : stream , config : c , eventC : make ( chan Event , 1 ) , watchedDirs : dirs , } , nil }
NewEventReader creates a new EventProducer backed by FSEvents macOS facility.
NewEventReader creates a new EventProducer backed by FSEvents macOS facility .
// NoDefer: Ignore Latency field and send events as fast as possible. //          Useful as latency has one second granularity. // // WatchRoot: Will send a notification when some element changes along // 			the path being watched (dir moved or deleted). // // FileEvents: Get events for files not just directories // IgnoreSelf: Avoid infinite looping when auditbeat writes to a //			   watched directory. If specified tests won't work.