first commit
way too late.
This commit is contained in:
commit
d4f7dc57fc
53 files changed
+3518
No files matched your search
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package logpublisher
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLogPublisher(t *testing.T) {}
|
||||
Reference in new issue
Block a user