// Event accepts an event and sends it to the appropriate output stream based on the event's level.
// If the level is warning or higher, it is sent to STDERR. Otherwise it is sent to STDOUT.
552776
func (handler *StandardStreamsHandler) Event(logEvent *event.Event) error {
	if logEvent.Level >= event.Warning {
		return handler.stderrWriter.Event(logEvent)
	}
	return handler.stdoutWriter.Event(logEvent)
}
1029582
func (v *version) Events() EventInformer {
	return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
1338352
func (w *WebDebugger) Event(e *Event) {
	switch e.Type {
	case "request":
		w.CurrentRequests[e.RequestID] = requestInfo{
			URL:         e.Values["url"],
			Started:     time.Now(),
			ID:          e.RequestID,
			CollectorID: e.CollectorID,
		}
	case "response", "error":
		r := w.CurrentRequests[e.RequestID]
		r.Duration = time.Since(r.Started)
		r.ResponseStatus = e.Values["status"]
		w.RequestLog = append(w.RequestLog, r)
		delete(w.CurrentRequests, e.RequestID)
	}
}
322351
func (g *EventGenerator) Event() *Event {
	active, alive := g.r.Intn(2) > 0, g.r.Intn(2) > 0
	return &Event{
		ID:              fmt.Sprintf("%d", g.r.Uint64()),
		Station:         g.g.String(6, 2000),
		UserID:          int(g.g.Uint64(100000000)) + 1,
		Timestamp:       g.g.Time(time.Date(2017, time.January, 1, 0, 0, 0, 0, time.UTC), time.Second*3).Format(time.RFC3339),
		Favorites:       g.genFavorites(),
		Items:           g.genItems(),
		Ranking:         g.genItems(),
		IfaceThing:      String(g.g.String(5, 5)),
		Velocity:        g.r.Intn(1000) + 2500,
		Active:          active,
		Alive:           alive,
		DeceasedBoolean: alive,

		Geo: g.genGeo(),
	}

}
1260692
func (e EventListener) Event(event *core.Event) {
	value := e.Factory.GetConfigurationByKey(event.Key)
	openlogging.GetLogger().Infof("config value after change %s | %s", event.Key, value)
}
361953
func (c *SocketConnection) SendEvent(eventHeaders []string) error {
	if len(eventHeaders) <= 0 {
		return fmt.Errorf(ECouldNotSendEvent, len(eventHeaders))
	}

	// lock mutex to prevent event headers from conflicting
	c.mtx.Lock()
	defer c.mtx.Unlock()

	_, err := io.WriteString(c, "sendevent ")
	if err != nil {
		return err
	}

	for _, eventHeader := range eventHeaders {
		_, err := io.WriteString(c, eventHeader)
		if err != nil {
			return err
		}

		_, err = io.WriteString(c, "\r\n")
		if err != nil {
			return err
		}

	}

	_, err = io.WriteString(c, "\r\n")
	if err != nil {
		return err
	}

	return nil
}
1089617
func (c *Client) Event(e *Event) error {
	if c == nil {
		return fmt.Errorf("Client is nil")
	}
	stat, err := e.Encode(c.Tags...)
	if err != nil {
		return err
	}
	return c.sendMsg([]byte(stat))
}
918735
func (g *GoHttpServer) Event(event Event, args interface{}) (r EventResponse) {
	switch event {
	case ENGINE_STARTED:
		signal.Notify(g.signalChan, os.Interrupt, os.Kill)
		go func() {
			_ = <-g.signalChan
			serverLogger.Info("Received quit singal Please wait ... ")
			RaiseEvent(ENGINE_SHUTDOWN_REQUEST, nil)
		}()
	case ENGINE_SHUTDOWN_REQUEST:
		ctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(Config.IntDefault("app.cancel.timeout", 60)))
		defer cancel()
		g.Server.Shutdown(ctx)
	default:

	}

	return
}
43277
func (g *GitHttp) event(e Event) {
	if g.EventHandler != nil {
		g.EventHandler(e)
	} else {
		fmt.Printf("EVENT: %q\n", e)
	}
}
764600
func (c *containerAdapter) events(ctx context.Context) <-chan events.Message {
	log.G(ctx).Debugf("waiting on events")
	buffer, l := c.backend.SubscribeToEvents(time.Time{}, time.Time{}, c.container.eventFilter())
	eventsq := make(chan events.Message, len(buffer))

	for _, event := range buffer {
		eventsq <- event
	}

	go func() {
		defer c.backend.UnsubscribeFromEvents(l)

		for {
			select {
			case ev := <-l:
				jev, ok := ev.(events.Message)
				if !ok {
					log.G(ctx).Warnf("unexpected event message: %q", ev)
					continue
				}
				select {
				case eventsq <- jev:
				case <-ctx.Done():
					return
				}
			case <-ctx.Done():
				return
			}
		}
	}()

	return eventsq
}
270423
func Level(buffer Buffer, event *cue.Event) {
	buffer.AppendString(event.Level.String())
}
690389
func IsPutEvent(event notify.Event) bool {
	for _, ev := range EventTypePut {
		if event&ev != 0 {
			return true
		}
	}
	return false
}
260617
func _() {
	var _ Event = (*Absolute)(nil)        // assert *Absolute implements Event
	var _ Event = (*FAbsolute)(nil)       // assert *FAbsolute implements Event
	var _ Event = (*Gauge)(nil)           // assert *Gauge implements Event
	var _ Event = (*FGauge)(nil)          // assert *FGauge implements Event
	var _ Event = (*GaugeDelta)(nil)      // assert *GaugeDelta implements Event
	var _ Event = (*FGaugeDelta)(nil)     // assert *FGaugeDelta implements Event
	var _ Event = (*Increment)(nil)       // assert *Increment implements Event
	var _ Event = (*PrecisionTiming)(nil) // assert *PrecisionTiming implements Event
	var _ Event = (*Timing)(nil)          // assert *Timing implements Event
	var _ Event = (*Total)(nil)           // assert *Total implements Event
}
215755
func (h *Handler) HandleEvent(e *events.Event) {
	f := fmtPool.Get().(*formatter)
	f.buffer.Reset()
	f.emitter.Reset(&f.buffer)

	f.level = "INFO"
	f.time = e.Time
	f.message = e.Message
	f.data.args = e.Args
	f.info.Source = e.Source
	f.info.Program = h.Program
	f.info.Pid = h.Pid

	if e.Debug {
		f.level = "DEBUG"
	}

	for _, a := range e.Args {
		if err, ok := a.Value.(error); ok {
			f.level = "ERROR"
			f.info.Errors = append(f.info.Errors, makeEventError(err))
		}
	}

	(objconv.Encoder{Emitter: &f.emitter}).Encode(f.value)
	f.buffer.WriteByte('\n')

	h.mutex.Lock()
	h.Output.Write(f.buffer.b)
	h.mutex.Unlock()

	f.info.Source = ""
	f.info.Errors = f.info.Errors[:0]
	fmtPool.Put(f)
}
721627
func (c *GorymanClient) SendEvent(e *Event) error {
	epb, err := EventToProtocolBuffer(e)
	if err != nil {
		return err
	}

	message := &proto.Msg{}
	message.Events = append(message.Events, epb)

	_, err = c.sendMaybeRecv(message)
	return err
}
502799
func (args eventArgs) ToEvent() event.Event {
	getOriginEndpoint := func() string {
		host := globalMinioHost
		if host == "" {
			// FIXME: Send FQDN or hostname of this machine than sending IP address.
			host = sortIPs(localIP4.ToSlice())[0]
		}

		return fmt.Sprintf("%s://%s", getURLScheme(globalIsSSL), net.JoinHostPort(host, globalMinioPort))
	}

	eventTime := UTCNow()
	uniqueID := fmt.Sprintf("%X", eventTime.UnixNano())

	respElements := map[string]string{
		"x-amz-request-id":        args.RespElements["requestId"],
		"x-minio-origin-endpoint": getOriginEndpoint(), // MinIO specific custom elements.
	}
	// Add deployment as part of
	if globalDeploymentID != "" {
		respElements["x-minio-deployment-id"] = globalDeploymentID
	}
	if args.RespElements["content-length"] != "" {
		respElements["content-length"] = args.RespElements["content-length"]
	}
	newEvent := event.Event{
		EventVersion:      "2.0",
		EventSource:       "minio:s3",
		AwsRegion:         args.ReqParams["region"],
		EventTime:         eventTime.Format(event.AMZTimeFormat),
		EventName:         args.EventName,
		UserIdentity:      event.Identity{PrincipalID: args.ReqParams["accessKey"]},
		RequestParameters: args.ReqParams,
		ResponseElements:  respElements,
		S3: event.Metadata{
			SchemaVersion:   "1.0",
			ConfigurationID: "Config",
			Bucket: event.Bucket{
				Name:          args.BucketName,
				OwnerIdentity: event.Identity{PrincipalID: args.ReqParams["accessKey"]},
				ARN:           policy.ResourceARNPrefix + args.BucketName,
			},
			Object: event.Object{
				Key:       url.QueryEscape(args.Object.Name),
				VersionID: "1",
				Sequencer: uniqueID,
			},
		},
		Source: event.Source{
			Host:      args.Host,
			UserAgent: args.UserAgent,
		},
	}

	if args.EventName != event.ObjectRemovedDelete {
		newEvent.S3.Object.ETag = args.Object.ETag
		newEvent.S3.Object.Size = args.Object.Size
		if args.Object.IsCompressed() {
			newEvent.S3.Object.Size = args.Object.GetActualSize()
		}
		newEvent.S3.Object.ContentType = args.Object.ContentType
		newEvent.S3.Object.UserMetadata = args.Object.UserDefined
	}

	return newEvent
}
645372
func (h EventHandlerFunc) HandleEvent(ctx context.Context, e Event) error {
	return h(ctx, e)
}