// NewWatch creates a new watch object
NewWatch creates a new watch object
// NewWatch creates a new watch object
func NewWatch(c CONF.Conf) (newWatch *Watch, err error) {
	regexs := []*regexp.Regexp{}
	for _, rS := range c.Regexs {
		r, err := regexp.Compile(rS)
		if err != nil {
			return nil, log.Error("Regex Does not compile: ", err)
		}
		regexs = append(regexs, r)
	}
	duration, err := parseDuration(c.ScanEvery)
	if err != nil {
		return nil, log.Error("Error parsing scanEvery duration: ", err)
	}
	newWatch = &Watch{
		Life:      L.NewLife(),
		Files:     c.Files,
		Timer:     time.NewTimer(0 * time.Second),
		Year:      c.Year,
		Month:     c.Month,
		Day:       c.Day,
		OutputDir: c.OutputDir,
		Regexs:    regexs,
		BadLines:  c.Flagged,
		Duration:  duration,
	}
	newWatch.SetRun(newWatch.run)
	return newWatch, err
}
func NewWatch ( c CONF . Conf ) ( newWatch * Watch , err error ) { regexs := [ ] * regexp . Regexp { } for _ , rS := range c . Regexs { r , err := regexp . Compile ( rS ) if err != nil { return nil , log . Error ( " " , err ) } regexs = append ( regexs , r ) } duration , err := parseDuration ( c . ScanEvery ) if err != nil { return nil , log . Error ( " " , err ) } newWatch = & Watch { Life : L . NewLife ( ) , Files : c . Files , Timer : time . NewTimer ( 0 * time . Second ) , Year : c . Year , Month : c . Month , Day : c . Day , OutputDir : c . OutputDir , Regexs : regexs , BadLines : c . Flagged , Duration : duration , } newWatch . SetRun ( newWatch . run ) return newWatch , err }
NewWatch creates a new watch object
NewWatch creates a new watch object