def log_solr_search(sender, **kwargs): """ extracts some data from the solr for log/analytics purposes """ if hasattr(g, 'user_cookie_id'): resp = kwargs.pop('response') log_data = { 'q': resp.get_query(), 'hits': resp.get_hits(), 'count': resp.get_count(), 'start': resp.get_start_count(), 'qtime': resp.get_qtime(), 'results': resp.get_doc_values('bibcode', 0, config.SEARCH_DEFAULT_ROWS), 'error_msg': resp.get_error_message(), 'http_status': resp.get_http_status(), 'solr_url': resp.request.url, 'user_cookie_id': g.user_cookie_id } log_data.update(kwargs) event = LogEvent.new(request.url, **log_data) logging.getLogger('search').info(event)
def log_abstract_view(sender, **kwargs): kwargs['user_cookie_id'] = g.user_cookie_id event = LogEvent.new(request.url, **kwargs) logging.getLogger('abs').info(event)
def log_solr_error(sender, **kwargs): if hasattr(g, 'user_cookie_id'): kwargs['user_cookie_id'] = g.user_cookie_id event = LogEvent.new(request.url, **kwargs) logging.getLogger('search').info(event)