// Emit adds an event to be flushed later in Flush.
//
// 'Who' and 'When' fields are populated in Flush using values from the context.
551474
func (t *Events) Emit(e *api.Event) {
	t.ev = append(t.ev, e)
}
832414
func (e *EBus) Emit(event string, data interface{}) {
	go func() {
		log.Debugf("emmiting event `%s`", event)

		if topic, ok := e.eventList[event]; ok {
			log.Debug("found listeners for event " + event)

			for el := topic.Front(); el != nil; el = el.Next() {
				fn := el.Value.(EvHandler)
				fn(data)
			}
		} else {
			log.Debugf("listeners for event %s not found", event)
		}
	}()
}
869846
func (e *eventDebouncer) flush() {
	if len(e.events) == 0 {
		return
	}

	// if the flush interval is faster than the callback then we will end up calling
	// the callback multiple times, probably a bad idea. In this case we could drop
	// frames?
	go e.callback(e.events)
	e.events = make([]frame, 0, eventBufferSize)
}
1146965
func (l *Lexer) emitContent() {
	if l.pos > l.start {
		l.emit(TokenContent)
	}
}
102431
func HTTPPostEmitter(uri, key, pid string) EmitFunc {
	return EmitFunc(func(event Event) error {
		ba, err := event.Emit()
		if err != nil {
			return err
		}

		req, err := http.NewRequest("POST", uri, bytes.NewBuffer(ba))
		if err != nil {
			return err
		}
		req.Header.Set("Content-Type", "application/json")
		if len(pid) > 0 && len(key) > 0 {
			req.SetBasicAuth(pid, key)
		}
		resp, err := http.DefaultClient.Do(req)
		if err != nil {
			return err
		}
		defer resp.Body.Close()

		if resp.StatusCode != 200 && resp.StatusCode != 201 {
			return BadStatusError{resp.StatusCode}
		}
		return nil
	})
}
1285816
func (conn *Connection) Emit(event string, data interface{}) {
	conn.send <- &message{
		event: event,
		data:  data,
	}
}
938434
func (l *AuditLog) emitEvent(e AuditLogEvent) {
	if l.EventsC == nil {
		return
	}
	select {
	case l.EventsC <- &e:
		return
	default:
		l.Warningf("Blocked on the events channel.")
	}
}
770872
func (e *Exporter) Flush(ctx context.Context) {
	e.tracer.Flush(ctx)
}
1332470
func (e *eventEmitter) emit(typ EventType, data interface{}) {
	ev := Event{Type: typ, Packet: data}

	e.lock.Lock()
	lists := [][]EventHandler{}
	if handlers, ok := e.listeners[ev.Type]; ok {
		lists = append(lists, handlers)
	}
	if handlers, ok := e.once[ev.Type]; ok {
		lists = append(lists, handlers)
		delete(e.once, ev.Type)
	}
	e.lock.Unlock()

	for _, list := range lists {
		for _, handler := range list {
			go handler(ev)
		}
	}
}
1195729
func (l *lexer) emit(t itemType) {
	if l.pos > ast.Pos(len(l.input)) {
		l.pos = ast.Pos(len(l.input))
	}
	l.lastEmit = item{t, l.pos, l.input[l.start:l.pos]}
	l.items <- l.lastEmit
	l.start = l.pos
}
622207
func (e *Elector) sendEvent(event Event) {
	select {
	case e.events <- event:
	case <-e.closing:
		select {
		case e.events <- event:
		default:
			// drop outgoing events if close was called and there is no
			// longer a listener awaiting events.
		}
	}
}
17240
func (self *TimedRotatingFileHandler) Emit(record *LogRecord) error {
	return self.RolloverEmit(self, record)
}
705802
func (l *Logger) Emit(level int, message string, extra Map) {
	l.e.Emit(l, level, message, extra)
}
709454
func (self *FileHandler) Emit(record *LogRecord) error {
	return self.StreamHandler.Emit2(self, record)
}
74153
func EmitEvent(c context.Context, e *api.Event) error {
	ev := Events{}
	ev.Emit(e)
	return ev.Flush(c)
}
507129
func (conn *Conn) Emit(path ObjectPath, name string, values ...interface{}) error {
	if !path.IsValid() {
		return errors.New("dbus: invalid object path")
	}
	i := strings.LastIndex(name, ".")
	if i == -1 {
		return errors.New("dbus: invalid method name")
	}
	iface := name[:i]
	member := name[i+1:]
	if !isValidMember(member) {
		return errors.New("dbus: invalid method name")
	}
	if !isValidInterface(iface) {
		return errors.New("dbus: invalid interface name")
	}
	msg := new(Message)
	msg.Type = TypeSignal
	msg.serial = conn.getSerial()
	msg.Headers = make(map[HeaderField]Variant)
	msg.Headers[FieldInterface] = MakeVariant(iface)
	msg.Headers[FieldMember] = MakeVariant(member)
	msg.Headers[FieldPath] = MakeVariant(path)
	msg.Body = values
	if len(values) > 0 {
		msg.Headers[FieldSignature] = MakeVariant(SignatureOf(values...))
	}

	var closed bool
	conn.sendMessageAndIfClosed(msg, func() {
		closed = true
	})
	if closed {
		return ErrClosed
	}
	return nil
}
260801
func (self *Dbgr) getEmit() _emit {
	if self.emit == nil {
		self.emit = standardEmit()
	}
	return self.emit
}