Retrieves a string representation of the event.

    Args:
      event (EventObject): event.

    Returns:
      str: string representation of the event.
327609
def GetFormattedEventObject(cls, event):
    
    time_string = timelib.Timestamp.CopyToIsoFormat(event.timestamp)

    lines_of_text = [
        '+-' * 40,
        '[Timestamp]:',
        '  {0:s}'.format(time_string)]

    pathspec = getattr(event, 'pathspec', None)
    if pathspec:
      lines_of_text.append('[Pathspec]:')
      attribute_string = pathspec.comparable.replace('\n', '\n  ')
      attribute_string = '  {0:s}\n'.format(attribute_string)
      lines_of_text.append(attribute_string)

    # TODO: add support for event tag after event clean up.

    lines_of_text.append('[Reserved attributes]:')
    out_additional = ['[Additional attributes]:']

    for attribute_name, attribute_value in sorted(event.GetAttributes()):
      if attribute_name not in definitions.RESERVED_VARIABLE_NAMES:
        attribute_string = '  {{{0!s}}} {1!s}'.format(
            attribute_name, attribute_value)
        out_additional.append(attribute_string)

      elif attribute_name not in ('pathspec', 'tag'):
        attribute_string = '  {{{0!s}}} {1!s}'.format(
            attribute_name, attribute_value)
        lines_of_text.append(attribute_string)

    lines_of_text.append('')
    out_additional.append('')

    lines_of_text.extend(out_additional)
    return '\n'.join(lines_of_text)
172549
def get_event(self):
        

        if not self.is_event_message:
            return None

        # select a dummy field (eg. subject) to avoid pull unneccesary data
        query = self.q().select('subject').expand('event')

        url = self.build_url(self._endpoints.get('get_message').format(id=self.object_id))

        response = self.con.get(url, params=query.as_params())

        if not response:
            return None

        data = response.json()
        event_data = data.get(self._cc('event'))

        return Event(parent=self, **{self._cloud_data_key: event_data})
1046716
@Override
  public  String getIndexName(Event event) {
    String realIndexPrefix = BucketPath.escapeString(event.getIndexPrefix() != null ? event.getIndexPrefix() : indexPrefix, event.getHeaders());
    if(event.getIndexTimestamp() != null){

      String indexName = new StringBuilder(realIndexPrefix).append('-')
              .append(event.getIndexTimestamp()).toString();
      if(logger.isDebugEnabled())
        logger.debug("Index Name = " + indexName);
      return indexName;
    }
    else {
      TimestampedEvent timestampedEvent = new TimestampedEvent(event);
      long timestamp = timestampedEvent.getTimestamp();
      String indexName = new StringBuilder(realIndexPrefix).append('-')
              .append(fastDateFormat.format(timestamp)).toString();
      if(logger.isDebugEnabled())
        logger.debug("Index Name = " + indexName);
      return indexName;
    }
  }
266283
def _to_event_data(obj):
    '''
    
    '''

    if obj is None:
        return None
    if isinstance(obj, bool):
        return obj
    if isinstance(obj, int):
        return obj
    if isinstance(obj, float):
        return obj
    if isinstance(obj, str):
        return obj
    if isinstance(obj, bytes):
        return obj
    if isinstance(obj, dict):
        return obj

    if isinstance(obj, NodeDriver):  # Special case for NodeDriver (cyclic references)
        return obj.name

    if isinstance(obj, list):
        return [_to_event_data(item) for item in obj]

    event_data = {}
    for attribute_name in dir(obj):
        if attribute_name.startswith('_'):
            continue

        attribute_value = getattr(obj, attribute_name)

        if callable(attribute_value):  # Strip out methods
            continue

        event_data[attribute_name] = _to_event_data(attribute_value)

    return event_data
968673
def WriteEvent(self, event):
    
    self.WriteEventStart()

    try:
      self.WriteEventBody(event)

    except errors.NoFormatterFound as exception:
      error_message = 'unable to retrieve formatter with error: {0!s}'.format(
          exception)
      self._ReportEventError(event, error_message)

    except errors.WrongFormatter as exception:
      error_message = 'wrong formatter with error: {0!s}'.format(exception)
      self._ReportEventError(event, error_message)

    self.WriteEventEnd()
1264494
def WriteEventBody(self, event):
    
    output_values = []
    for field_name in self._fields:
      output_value = self._dynamic_fields_helper.GetFormattedField(
          event, field_name)

      output_value = self._SanitizeField(output_value)
      output_values.append(output_value)

    output_line = '{0:s}\n'.format(self._field_delimiter.join(output_values))
    self._output_writer.Write(output_line)
721322
def _FormatMessage(self, event):
    
    message, _ = self._output_mediator.GetFormattedMessages(event)
    if message is None:
      data_type = getattr(event, 'data_type', 'UNKNOWN')
      raise errors.NoFormatterFound(
          'Unable to find event formatter for: {0:s}.'.format(data_type))

    return message
731458
def dispatch_event(event):
    

    try:
      if event.http_verb == enums.HTTPVerbs.GET:
        requests.get(event.url, params=event.params, timeout=REQUEST_TIMEOUT).raise_for_status()
      elif event.http_verb == enums.HTTPVerbs.POST:
        requests.post(
          event.url, data=json.dumps(event.params), headers=event.headers, timeout=REQUEST_TIMEOUT
        ).raise_for_status()

    except request_exception.RequestException as error:
      logging.error('Dispatch event failed. Error: %s' % str(error))
191015
public String format(LoggingEvent event) {
        JsonObject jsonEvent = new JsonObject();
        jsonEvent.addProperty("v", 0);
        jsonEvent.addProperty("level", BUNYAN_LEVEL.get(event.getLevel()));
        jsonEvent.addProperty("name", event.getLoggerName());
        try {
            jsonEvent.addProperty("hostname", InetAddress.getLocalHost().getHostName());
        } catch (UnknownHostException e) {
            jsonEvent.addProperty("hostname", "unkown");
        }
        jsonEvent.addProperty("pid", getThreadId(event));
        jsonEvent.addProperty("time", formatAsIsoUTCDateTime(event.getTimeStamp()));
        jsonEvent.addProperty("msg", event.getMessage().toString());

        if (event.getLevel().isGreaterOrEqual(Level.ERROR) && event.getThrowableInformation() != null) {
            JsonObject jsonError = new JsonObject();
            Throwable e = event.getThrowableInformation().getThrowable();

            jsonError.addProperty("message", e.getMessage());
            jsonError.addProperty("name", e.getClass().getSimpleName());

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            jsonError.addProperty("stack", sw.toString());
            jsonEvent.add("err", jsonError);
        }
        return GSON.toJson(jsonEvent) + "\n";
    }
810445
private <E extends Event> EventListener<E> getEventListener(E event) {
        @SuppressWarnings("unchecked")
        EventListener<E> eventListener = (EventListener<E>) eventListenerMap.get(event.getClass());
        return eventListener;
    }
220548
private function getEventMessage(Event $event)
    {
        return json_encode([
            'title' => $event->getTitle(),
            'text' => $event->getText(),
            'timestamp' => $event->getTimeStamp(),
            'host' => $event->getHost(),
            'type' => $event->getType()
        ]);
    }
641975
def as_string(self, forsigning=False):
		
		ret = OutBuffer()
		self.serialize(ret, forsigning)
		return ret.getvalue()
41733
def WriteEventBody(self, event):
    
    inode = getattr(event, 'inode', None)
    if inode is None:
      event.inode = 0

    json_dict = self._JSON_SERIALIZER.WriteSerializedDict(event)
    json_string = json.dumps(json_dict, sort_keys=True)

    if self._event_counter != 0:
      self._output_writer.Write(', ')

    line = '"event_{0:d}": {1:s}\n'.format(self._event_counter, json_string)
    self._output_writer.Write(line)

    self._event_counter += 1
319914
def _ReadEventDataIntoEvent(self, event):
    
    if self._storage_type != definitions.STORAGE_TYPE_SESSION:
      return

    event_data_identifier = event.GetEventDataIdentifier()
    if event_data_identifier:
      lookup_key = event_data_identifier.CopyToString()
      event_data = self._event_data[lookup_key]

      for attribute_name, attribute_value in event_data.GetAttributes():
        setattr(event, attribute_name, attribute_value)
521528
function parse (event) {
  var parts = event.split(/ +/)
  return {
    name: parts.shift(),
    selector: parts.join(' ')
  }
}
369205
def parse_game_event(self, event):
        

        if event.eventid in self.event_lookup:
            #Bash this into a nicer data format to work with
            event_type = self.event_lookup[event.eventid]
            ge = GameEvent(event_type.name)

            for i, key in enumerate(event.keys):
                key_type = event_type.keys[i]
                ge.keys[key_type.name] = getattr(key,
                                                    KEY_DATA_TYPES[key.type])

            self.debug("|==========> %s" % (ge, ))

            self.run_hooks(ge)
980941
def match(cls, event):
        
        if 'detail' not in event:
            return False
        if 'eventName' not in event['detail']:
            return False
        k = event['detail']['eventName']

        # We want callers to use a compiled expression, but want to avoid
        # initialization cost of doing it without cause. Not thread safe,
        # but usage context is lambda entry.
        if k in cls.trail_events:
            v = dict(cls.trail_events[k])
            if isinstance(v['ids'], six.string_types):
                v['ids'] = e = jmespath.compile('detail.%s' % v['ids'])
                cls.trail_events[k]['ids'] = e
            return v

        return False