def GetMessages(self, formatter_mediator, event):
    """Determines the formatted message strings for an event object.

    Args:
      formatter_mediator (FormatterMediator): mediates the interactions between
          formatters and other components, such as storage and Windows EventLog
          resources.
      event (EventObject): event.

    Returns:
      tuple(str, str): formatted message string and short message string.

    Raises:
      WrongFormatter: if the event object cannot be formatted by the formatter.
    """
    if self.DATA_TYPE != event.data_type:
      raise errors.WrongFormatter('Unsupported data type: {0:s}.'.format(
          event.data_type))

    event_values = event.CopyToDict()

    page_transition_type = event_values.get('page_transition_type', None)
    if page_transition_type is not None:
      page_transition, page_transition_long = self._PAGE_TRANSITIONS.get(
          page_transition_type, self._UNKNOWN_PAGE_TRANSITION)

      if page_transition_long:
        event_values['page_transition'] = '{0:s} - {1:s}'.format(
            page_transition, page_transition_long)
      else:
        event_values['page_transition'] = page_transition

    visit_source = event_values.get('visit_source', None)
    if visit_source is not None:
      event_values['visit_source'] = self._VISIT_SOURCE.get(
          visit_source, 'UNKNOWN')

    extras = []

    url_hidden = event_values.get('url_hidden', False)
    if url_hidden:
      extras.append('(url hidden)')

    typed_count = event_values.get('typed_count', 0)
    if typed_count == 0:
      extras.append('(URL not typed directly - no typed count)')
    elif typed_count == 1:
      extras.append('(type count {0:d} time)'.format(typed_count))
    else:
      extras.append('(type count {0:d} times)'.format(typed_count))

    event_values['extra'] = ' '.join(extras)

    return self._ConditionalFormatMessages(event_values)
def GetMessages ( self , formatter_mediator , event ) : if self . DATA_TYPE != event . data_type : raise errors . WrongFormatter ( 'Unsupported data type: {0:s}.' . format ( event . data_type ) ) event_values = event . CopyToDict ( ) page_transition_type = event_values . get ( 'page_transition_type' , None ) if page_transition_type is not None : page_transition , page_transition_long = self . _PAGE_TRANSITIONS . get ( page_transition_type , self . _UNKNOWN_PAGE_TRANSITION ) if page_transition_long : event_values [ 'page_transition' ] = '{0:s} - {1:s}' . format ( page_transition , page_transition_long ) else : event_values [ 'page_transition' ] = page_transition visit_source = event_values . get ( 'visit_source' , None ) if visit_source is not None : event_values [ 'visit_source' ] = self . _VISIT_SOURCE . get ( visit_source , 'UNKNOWN' ) extras = [ ] url_hidden = event_values . get ( 'url_hidden' , False ) if url_hidden : extras . append ( '(url hidden)' ) typed_count = event_values . get ( 'typed_count' , 0 ) if typed_count == 0 : extras . append ( '(URL not typed directly - no typed count)' ) elif typed_count == 1 : extras . append ( '(type count {0:d} time)' . format ( typed_count ) ) else : extras . append ( '(type count {0:d} times)' . format ( typed_count ) ) event_values [ 'extra' ] = ' ' . join ( extras ) return self . _ConditionalFormatMessages ( event_values )
Determines the formatted message strings for an event object.

    Args:
      formatter_mediator (FormatterMediator): mediates the interactions between
          formatters and other components, such as storage and Windows EventLog
          resources.
      event (EventObject): event.

    Returns:
      tuple(str, str): formatted message string and short message string.

    Raises:
      WrongFormatter: if the event object cannot be formatted by the formatter.