(dir string)
| 430 | } |
| 431 | |
| 432 | func NewLogFileWatcher(dir string) (*fsnotify.Watcher, error) { |
| 433 | watcher, err := fsnotify.NewWatcher() |
| 434 | if err != nil { |
| 435 | return nil, fmt.Errorf("failed to create fsnotify watcher: %v", err) |
| 436 | } |
| 437 | if err = watcher.Add(dir); err != nil { |
| 438 | watcher.Close() |
| 439 | return nil, fmt.Errorf("failed to watch directory %q: %w", dir, err) |
| 440 | } |
| 441 | return watcher, nil |
| 442 | } |
| 443 | |
| 444 | // startTail wait for the next log write. |
| 445 | // the boolean value indicates if the log file was recreated; |
no test coverage detected
searching dependent graphs…