func ParseLogFile(file io.ReadCloser) chan *LogEntry {
	ch := make(chan *LogEntry, 100)

	go func() {
		defer file.Close()
		defer close(ch)

		gzipReader, err := gzip.NewReader(file)
		if err != nil {
			panic(err.Error())
		}
		defer gzipReader.Close()

		csvReader := csv.NewReader(gzipReader)
		csvReader.Comma = ' '

		for {
			record, err := csvReader.Read()

			if err == io.EOF {
				return
			} else if err != nil {
				log.Println(err.Error())
				continue
			}

			logEntry, err := csvRowToLogEntry(record)

			if err != nil {
				log.Println(err.Error())
				continue
			}

			ch <- logEntry
		}

	}()

	return ch
}
// ParseLogFile will take stream for a gzipped log file, and return a channel of entries
ParseLogFile will take stream for a gzipped log file, and return a channel of entries
// ParseLogFile will take stream for a gzipped log file and return a channel of entries
func ParseLogFile(file io.ReadCloser) chan *LogEntry {
	ch := make(chan *LogEntry, 100)
	go func() {
		defer file.Close()
		defer close(ch)
		gzipReader, err := gzip.NewReader(file)
		if err != nil {
			panic(err.Error())
		}
		defer gzipReader.Close()
		csvReader := csv.NewReader(gzipReader)
		csvReader.Comma = ' '
		for {
			record, err := csvReader.Read()
			if err == io.EOF {
				return
			} else if err != nil {
				log.Println(err.Error())
				continue
			}
			logEntry, err := csvRowToLogEntry(record)
			if err != nil {
				log.Println(err.Error())
				continue
			}
			ch <- logEntry
		}
	}()
	return ch
}
func ParseLogFile ( file io . ReadCloser ) chan * LogEntry { ch := make ( chan * LogEntry , 100 ) go func ( ) { defer file . Close ( ) defer close ( ch ) gzipReader , err := gzip . NewReader ( file ) if err != nil { panic ( err . Error ( ) ) } defer gzipReader . Close ( ) csvReader := csv . NewReader ( gzipReader ) csvReader . Comma = ' ' for { record , err := csvReader . Read ( ) if err == io . EOF { return } else if err != nil { log . Println ( err . Error ( ) ) continue } logEntry , err := csvRowToLogEntry ( record ) if err != nil { log . Println ( err . Error ( ) ) continue } ch <- logEntry } } ( ) return ch }
ParseLogFile will take stream for a gzipped log file, and return a channel of entries
ParseLogFile will take stream for a gzipped log file and return a channel of entries