events
2015-12-14
Parent:ce1212549d47
events/stdout.go
Update to new nsqio repo. The go-nsq client is now located under a nsqio org on Github, so we need to update the import path.
1 package events
3 import (
4 "encoding/json"
5 "os"
6 )
8 type StdoutPublisher struct{}
10 func NewStdoutPublisher() StdoutPublisher {
11 return StdoutPublisher{}
12 }
14 func (p StdoutPublisher) Publish(topic string, e Event) error {
15 os.Stdout.Write([]byte(topic + ": "))
16 enc := json.NewEncoder(os.Stdout)
17 return enc.Encode(e)
18 }