Skip to content

Instantly share code, notes, and snippets.

@nd2408
nd2408 / example.go
Created January 25, 2024 08:42
fsnotify wrapper
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
AddSource: false,
Level: slog.LevelDebug,
}))
slog.SetDefault(logger)
watcher, err := watcher.New(logger)
defer watcher.Shutdown()
err = watcher.Watch("/home/user", func(e watcher.Event) error {