def get_sent_out_time(message_id):
    #  2014-03-03 16:00:03,597 [command] INFO: SMS[$MESSAGE_ID] SENT
    command_to_get_time = "grep -i %s messenger.log*" % message_id
    result = execute_command(command_to_get_time)
    regex = "(.*) \[command\] INFO: SMS(.*)"
    format_time = "%Y-%m-%d %H:%M:%S,%f"
    return get_time_from_result(result, regex, 1, format_time)
def get_start_handling_time(phone_number):
    path_to_ureport_app_log = "./ureport_app_logs"
    command_to_get_time = "grep -i %s %s/ureport_application* | head -n 1 " % (phone_number, path_to_ureport_app_log)
    result = execute_command(command_to_get_time)
    regex = "\.\/ureport_app_logs\/ureport_application\.log\.?[0-9]?[0-9]?:(.*) DEBUG(.*)"
    format_time = "%Y-%m-%d %H:%M:%S,%f"
    return get_time_from_result(result, regex, 1, format_time)
def get_response_finish_to_be_handled_time(response_id):
    path_to_ureport_app_log = "./ureport_app_logs"
    command_to_get_time = "grep -i %s %s/ureport_application*" % (response_id, path_to_ureport_app_log)
    result = execute_command(command_to_get_time)
    regex = "ureport_application\.log\.?[0-9]?[0-9]?:(.*) DEBUG(.*)"
    format_time = "%Y-%m-%d %H:%M:%S,%f"
    return get_time_from_result(result, regex, 1, format_time)
def get_receive_number_time(phone_number):
    """"
    The information is recollected from smsc.log. having log-level=0
    """""
    path_for_smsc_logs = "./yo_data_02_to_07"
    command_to_get_time = "grep %s %s/yo*" % (phone_number, path_for_smsc_logs)
    result = execute_command(command_to_get_time)
    regex = "yo1debug\.log\.?([0-9]|\_|[a-z])+:(.*) \[....\] \[.\] DEBUG:(.*)"
    format_time = "%Y-%m-%d %H:%M:%S"
    return get_time_from_result(result, regex, 2, format_time)
def get_throttle_time(phone_number):
    command_to_get_time = "grep -i send_directly_to_router.*%s throttle*" % phone_number
    result = execute_command(command_to_get_time)
    regex = "throttle\.log\.?([1-9])?:\[(.*): INFO\/Worker-[0-9]?\] throttle.tasks.send_directly_to_router(.*) "
    time_format = "%Y-%m-%d %H:%M:%S,%f"
    return get_time_from_result(result, regex, 2, time_format)