Example #1
0
func ChugWithFilter(reader io.Reader, minTime time.Time, maxTime time.Time, match *regexp.Regexp, exclude *regexp.Regexp) chan chug.Entry {
	chugOut := make(chan chug.Entry)
	go chug.Chug(reader, chugOut)
	filteredOut := make(chan chug.Entry)
	go filter(filteredOut, chugOut, minTime, maxTime, match, exclude)
	return filteredOut
}
Example #2
0
func ChugLagerEntries(raw []byte) []chug.LogEntry {
	buf := bytes.NewBuffer(raw)
	out := make(chan chug.Entry)
	go chug.Chug(buf, out)
	entries := []chug.LogEntry{}
	for entry := range out {
		if entry.IsLager {
			entries = append(entries, entry.Log)
		}
	}
	return entries
}
Example #3
0
)

var _ = Describe("Ginkgoreporter", func() {
	var (
		reporter reporters.Reporter
		buffer   *bytes.Buffer
	)

	BeforeEach(func() {
		buffer = &bytes.Buffer{}
		reporter = New(buffer)
	})

	fetchLogs := func() []chug.LogEntry {
		out := make(chan chug.Entry, 1000)
		chug.Chug(buffer, out)
		logs := []chug.LogEntry{}
		for entry := range out {
			if entry.IsLager {
				logs = append(logs, entry.Log)
			}
		}
		return logs
	}

	jsonRoundTrip := func(object interface{}) interface{} {
		jsonEncoded, err := json.Marshal(object)
		Ω(err).ShouldNot(HaveOccurred())
		var out interface{}
		err = json.Unmarshal(jsonEncoded, &out)
		Ω(err).ShouldNot(HaveOccurred())