(taskid, start, end)
return jsonize({"success": True, "log": json_log_messages})
Retrieve a subset of log messages
Retrieve a subset of log messages
Retrieve a subset of log messages
def scan_log_limited(taskid, start, end):
    """
    Retrieve a subset of log messages
    """
    json_log_messages = list()

    if taskid not in DataStore.tasks:
        logger.warning("[%s] Invalid task ID provided to scan_log_limited()" % taskid)
        return jsonize({"success": False, "message": "Invalid task ID"})

    if not start.isdigit() or not end.isdigit() or end < start:
        logger.warning("[%s] Invalid start or end value provided to scan_log_limited()" % taskid)
        return jsonize({"success": False, "message": "Invalid start or end value, must be digits"})

    start = max(1, int(start))
    end = max(1, int(end))

    # Read a subset of log messages from the IPC database
    for time_, level, message in DataStore.current_db.execute(
            ("SELECT time, level, message FROM logs WHERE "
             "taskid = ? AND id >= ? AND id <= ? ORDER BY id ASC"),
            (taskid, start, end)):
        json_log_messages.append({"time": time_, "level": level, "message": message})

    logger.debug("[%s] Retrieved scan log messages subset" % taskid)
    return jsonize({"success": True, "log": json_log_messages})
def scan_log_limited ( taskid , start , end ) : json_log_messages = list ( ) if taskid not in DataStore . tasks : logger . warning ( "[%s] Invalid task ID provided to scan_log_limited()" % taskid ) return jsonize ( { "success" : False , "message" : "Invalid task ID" } ) if not start . isdigit ( ) or not end . isdigit ( ) or end < start : logger . warning ( "[%s] Invalid start or end value provided to scan_log_limited()" % taskid ) return jsonize ( { "success" : False , "message" : "Invalid start or end value, must be digits" } ) start = max ( 1 , int ( start ) ) end = max ( 1 , int ( end ) ) # Read a subset of log messages from the IPC database for time_ , level , message in DataStore . current_db . execute ( ( "SELECT time, level, message FROM logs WHERE " "taskid = ? AND id >= ? AND id <= ? ORDER BY id ASC" ) , ( taskid , start , end ) ) : json_log_messages . append ( { "time" : time_ , "level" : level , "message" : message } ) logger . debug ( "[%s] Retrieved scan log messages subset" % taskid ) return jsonize ( { "success" : True , "log" : json_log_messages } )