Ejemplo n.º 1
0
 def render_requests_data_to_html(self, data, file_name, context={}):
     """Render to HTML file"""
     file_path = os.path.join(self.html_dir, file_name)
     logger.info('Rendering HTML file %s...' % file_path)
     data = format_data(data)
     data.update(context)
     data.update(domain=self.domain)
     with open(file_path, 'w') as fp:
         fp.write(smart_str(render_template('realtime.html', data)))
Ejemplo n.º 2
0
 def render_requests_data_to_html(self, data, file_name, context={}):
     """Render to HTML file"""
     file_path = os.path.join(self.html_dir, file_name)
     logger.info('Rendering HTML file %s...' % file_path)
     data = format_data(data)
     data.update(context)
     data.update(domain=self.domain)
     with open(file_path, 'w') as fp:
         fp.write(smart_str(render_template('realtime.html', data)))
Ejemplo n.º 3
0
def analyze(args):
    # Get custom url rules
    url_rules = []
    if args.url_file:
        url_rules = parse_url_rules(args.url_file)

    logger.info('Analyzing log file "%s"...' % args.filepath.name)
    start_time = time.time()
    data = analyze_log(args.filepath, args, url_rules)
    data = format_data(data, args.limit_per_url_group, args.limit_url_groups)
    data.update({
        'domain': args.domain,
        'input_filename': args.filepath.name,
        'min_duration': args.min_msecs,
    })

    # Pre-process data
    html_data = render_template('report.html', data)

    args.output.write(smart_str(html_data))
    args.output.close()
    logger.info('Finished in %.2f seconds.' % (time.time() - start_time))
Ejemplo n.º 4
0
def analyze(args):
    # Get custom url rules
    url_rules = []
    if args.url_file:
        url_rules = parse_url_rules(args.url_file)

    logger.info('Analyzing log file "%s"...' % args.filepath.name)
    start_time = time.time()
    data = analyze_log(args.filepath, args, url_rules)
    data = format_data(data)
    data.update({
        'domain': args.domain,
        'input_filename': args.filepath.name,
        'min_duration': args.min_msecs,
    })

    # Pre-process data
    html_data = render_template('report.html', data)

    args.output.write(smart_str(html_data))
    args.output.close()
    logger.info('Finished in %.2f seconds.' % (time.time() - start_time))