Use statistics logger in example app
This commit is contained in:
parent
0549519e0e
commit
78cfb92db3
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/localhots/satan"
|
"github.com/localhots/satan"
|
||||||
"github.com/localhots/satan/example/daemons"
|
"github.com/localhots/satan/example/daemons"
|
||||||
"github.com/localhots/satan/example/kafka"
|
"github.com/localhots/satan/example/kafka"
|
||||||
|
"github.com/localhots/satan/stats"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -29,8 +30,13 @@ func main() {
|
|||||||
kafka.Initialize(strings.Split(brokers, " "))
|
kafka.Initialize(strings.Split(brokers, " "))
|
||||||
defer kafka.Shutdown()
|
defer kafka.Shutdown()
|
||||||
|
|
||||||
|
logger := stats.NewStdoutLogger(0)
|
||||||
|
defer logger.Print()
|
||||||
|
|
||||||
s := satan.Summon()
|
s := satan.Summon()
|
||||||
s.SubscribeFunc = kafka.Subscribe
|
s.SubscribeFunc = kafka.Subscribe
|
||||||
|
s.Statistics = logger
|
||||||
|
|
||||||
s.AddDaemon(&daemons.NumberPrinter{})
|
s.AddDaemon(&daemons.NumberPrinter{})
|
||||||
s.AddDaemon(&daemons.PriceConsumer{})
|
s.AddDaemon(&daemons.PriceConsumer{})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user