3
3
package monitor
4
4
5
5
import (
6
- "fmt"
7
6
"log"
8
7
"os"
9
8
"path/filepath"
@@ -60,7 +59,7 @@ func WatchWiki(w *wiki.Wiki) {
60
59
}
61
60
dirs [dir ] = handler
62
61
if err := filepath .Walk (dir , walkDir ); err != nil {
63
- fmt .Println ("ERROR" , err )
62
+ log .Println ("ERROR" , err )
64
63
}
65
64
}
66
65
@@ -89,7 +88,7 @@ func WatchWiki(w *wiki.Wiki) {
89
88
// new directory created -- add to monitor
90
89
fi , err := os .Lstat (abs )
91
90
if err == nil && fi .IsDir () && event .Op & fsnotify .Create == fsnotify .Create {
92
- fmt .Println ("adding dir" , abs )
91
+ log .Println ("adding dir" , abs )
93
92
mon .watching [abs ] = true
94
93
watcher .Add (abs )
95
94
continue
@@ -98,7 +97,7 @@ func WatchWiki(w *wiki.Wiki) {
98
97
// a directory we were watching has been deleted
99
98
// note: this catches renames also
100
99
if mon .watching [abs ] && event .Op & fsnotify .Remove == fsnotify .Remove {
101
- fmt .Println ("DELETE DIR" , event )
100
+ log .Println ("DELETE DIR" , event )
102
101
delete (mon .watching , abs )
103
102
// watcher.Remove(abs) // nvm, it does this automatically
104
103
continue
@@ -114,7 +113,7 @@ func WatchWiki(w *wiki.Wiki) {
114
113
115
114
// watch for errors
116
115
case err := <- watcher .Errors :
117
- fmt .Println ("ERROR" , err )
116
+ log .Println ("ERROR" , err )
118
117
}
119
118
}
120
119
}()
0 commit comments