Writes flow output plugin log entries for a given flow.

def WriteFlowOutputPluginLogEntries(self, entries, cursor=None):
    """Writes flow output plugin log entries for a given flow."""
    query = ("INSERT INTO flow_output_plugin_log_entries "
             "(client_id, flow_id, hunt_id, output_plugin_id, "
             "log_entry_type, message) "
             "VALUES ")
    templates = []
    args = []
    for entry in entries:
      templates.append("(%s, %s, %s, %s, %s, %s)")
      args.append(db_utils.ClientIDToInt(entry.client_id))
      args.append(db_utils.FlowIDToInt(entry.flow_id))
      if entry.hunt_id:
        args.append(db_utils.HuntIDToInt(entry.hunt_id))
      else:
        args.append(0)
      args.append(db_utils.OutputPluginIDToInt(entry.output_plugin_id))
      args.append(int(entry.log_entry_type))
      args.append(entry.message)

    query += ",".join(templates)

    try:
      cursor.execute(query, args)
    except MySQLdb.IntegrityError as e:
      raise db.AtLeastOneUnknownFlowError(
          [(entry.client_id, entry.flow_id) for entry in entries], cause=e)