Exemplo n.º 1
0
func init() {
	event.AddListener(func(ev *events.Reparent) {
		if ev.Status == "finished" {
			if c, ok := externalReparents[ev.ExternalID]; ok {
				close(c)
			}
		}
	})
}
Exemplo n.º 2
0
func init() {
	var err error
	writer, err = syslog.New(syslog.LOG_INFO|syslog.LOG_USER, os.Args[0])
	if err != nil {
		log.Errorf("can't connect to syslog")
		writer = nil
	}

	event.AddListener(listener)
}
Exemplo n.º 3
0
func TestUpdateDispatch(t *testing.T) {
	triggered := false
	event.AddListener(func(ev *testEvent) {
		triggered = true
	})

	want := "status"
	ev := &testEvent{}
	event.DispatchUpdate(ev, "status")

	if ev.Status != want {
		t.Errorf("ev.Status = %#v, want %#v", ev.Status, want)
	}
	if !triggered {
		t.Errorf("listener wasn't triggered on Dispatch()")
	}
}
Exemplo n.º 4
0
func init() {
	event.AddListener(listener)
}