first commit

way too late.
This commit is contained in:
didier amyot committed 2015-02-06 22:03:05 -08:00
commit d4f7dc57fc
53 files changed
+3518

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package logpublisher
import (
"log"
"github.com/didiercrunch/doormanserver/shared"
"gopkg.in/mgo.v2/bson"
)
type LogPublisher struct {
Printer func(v ...interface{})
}
func (pub *LogPublisher) Emit(doormanId bson.ObjectId, doorman shared.AsDoormanUpdatePayloader) error {
if data, err := doorman.AsDoormanUpdatePayload(); err != nil {
return err
} else {
pub.Printer(doormanId.Hex(), " : ", string(data))
return nil
}
}
func (pub *LogPublisher) Init() error {
pub.Printer = log.Println
return nil
}