'Write a log entry for a Frontend or UI Request.
Args:
request: A HttpRequest protobuf.
source: Client id of the client initiating the request. Optional.
message_count: Number of messages received from the client. Optional.'

def LogHttpFrontendAccess(self, request, source=None, message_count=None):

    event_id = self.GetNewEventId()
    log_msg = ('%s-%s    [%s]:    %s    %s    %s    %s    (%d)' % (event_id, request.source_ip, (source or '<unknown>'), request.method, request.url, request.user_agent, request.user, (message_count or 0)))
    logging.info(log_msg)
