func init() { event.AddListener(func(ev *events.Reparent) { if ev.Status == "finished" { if c, ok := externalReparents[ev.ExternalID]; ok { close(c) } } }) }
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) }
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()") } }
func init() { event.AddListener(listener) }