# Path: project/tools/logger.py
# def get_log_dicts(user_agent=None, path_regex=None, last_n_lines=None):
# def get_log_dicts_success():
# def get_log_dicts_failure():
# def clear_log(user_agents=None):
# def get_log_user_agents():
# def per_request_callbacks(response):
# def get_http_user_agent():


import StringIO
import matplotlib.pyplot as plt
from matplotlib import ticker
from matplotlib.backends.backend_svg import FigureCanvasSVG as FigureCanvas
from project.tools import logger
# -*- coding: utf-8 -*-



graph_colors = ['r', 'g', 'b', 'c', 'm', 'y', 'k']


def time_ticks(x, pos):
    return "{:10.2f}".format(float(x) / 1.0)


formatter = ticker.FuncFormatter(time_ticks)


def get_total_seconds(td):
    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6


def time_delta(dt1, dt2):
    return get_total_seconds(max([dt1, dt2]) - min([dt1, dt2]))


def draw_custom_graph(user_agents):
    plot_x_y = []

    # requests = log_parser.get_log_dicts(user_agent = r'SiteSucker.*')
    for user_agent in user_agents:

# Path: project/tools/logger.py
# def get_log_dicts(user_agent=None, path_regex=None, last_n_lines=None):
# def get_log_dicts_success():
# def get_log_dicts_failure():
# def clear_log(user_agents=None):
# def get_log_user_agents():
# def per_request_callbacks(response):
# def get_http_user_agent():


# Path: project/controllers/graph.py
import StringIO
import matplotlib.pyplot as plt
from matplotlib import ticker
from matplotlib.backends.backend_svg import FigureCanvasSVG as FigureCanvas
from project.tools import logger

# -*- coding: utf-8 -*-



graph_colors = ['r', 'g', 'b', 'c', 'm', 'y', 'k']


def time_ticks(x, pos):
    return "{:10.2f}".format(float(x) / 1.0)


formatter = ticker.FuncFormatter(time_ticks)


def get_total_seconds(td):
    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6


def time_delta(dt1, dt2):
    return get_total_seconds(max([dt1, dt2]) - min([dt1, dt2]))


def draw_custom_graph(user_agents):
    plot_x_y = []

    # requests = log_parser.get_log_dicts(user_agent = r'SiteSucker.*')
    for user_agent in user_agents:

        requests = logger.get_log_dicts(user_agent=user_agent)