def server_track(request, event_type, event, page=None):
 if (event_type.startswith('/event_logs') and request.user.is_staff):
  return
 try:
  username = request.user.username
 except:
  username = 'anonymous'
 event = {'username': username, 'ip': _get_request_ip(request), 'referer': _get_request_header(request, 'HTTP_REFERER'), 'accept_language': _get_request_header(request, 'HTTP_ACCEPT_LANGUAGE'), 'event_source': 'server', 'event_type': event_type, 'event': event, 'agent': _get_request_header(request, 'HTTP_USER_AGENT').decode('latin1'), 'page': page, 'time': datetime.datetime.utcnow(), 'host': _get_request_header(request, 'SERVER_NAME'), 'context': eventtracker.get_tracker().resolve_context()}
 shim.remove_shim_context(event)
 log_event(event)

def server_track ( request , event_type , event , page = None ) : if ( event_type . startswith ( '/event_logs' ) and request . user . is_staff ) : return try : username = request . user . username except : username = 'anonymous' event = { 'username' : username , 'ip' : _get_request_ip ( request ) , 'referer' : _get_request_header ( request , 'HTTP_REFERER' ) , 'accept_language' : _get_request_header ( request , 'HTTP_ACCEPT_LANGUAGE' ) , 'event_source' : 'server' , 'event_type' : event_type , 'event' : event , 'agent' : _get_request_header ( request , 'HTTP_USER_AGENT' ) . decode ( 'latin1' ) , 'page' : page , 'time' : datetime . datetime . utcnow ( ) , 'host' : _get_request_header ( request , 'SERVER_NAME' ) , 'context' : eventtracker . get_tracker ( ) . resolve_context ( ) } shim . remove_shim_context ( event ) log_event ( event )
log events related to server requests .