micro/debug/log/memory/stream.go

25 lines
325 B
Go
Raw Normal View History

2019-12-17 18:16:45 +00:00
package memory
import (
"github.com/micro/go-micro/v2/debug/log"
2019-12-17 18:16:45 +00:00
)
2019-12-17 16:56:55 +00:00
type logStream struct {
2019-12-17 18:16:45 +00:00
stream <-chan log.Record
2019-12-17 16:56:55 +00:00
stop chan bool
}
2019-12-17 18:16:45 +00:00
func (l *logStream) Chan() <-chan log.Record {
2019-12-17 16:56:55 +00:00
return l.stream
}
func (l *logStream) Stop() error {
select {
case <-l.stop:
return nil
default:
close(l.stop)
}
return nil
}