(dir string, onComplete func())
| 27 | } |
| 28 | |
| 29 | func (da *Auditor) EnableDataCapture(dir string, onComplete func()) { |
| 30 | da.mu.Lock() |
| 31 | defer da.mu.Unlock() |
| 32 | |
| 33 | da.dataDir = dir |
| 34 | da.onComplete = onComplete |
| 35 | if dir == "" || da.writeCh != nil { |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | da.writeCh = make(chan writeTask, writeQueueSize) |
| 40 | go da.runWriter(da.writeCh) |
| 41 | } |
| 42 | |
| 43 | func (da *Auditor) runWriter(ch <-chan writeTask) { |
| 44 | for task := range ch { |