'Adds a log to the database.
Parameters
jail : Jail
Jail that log is being monitored by.
container : FileContainer
File container of the log file being added.
Returns
int
If log was already present in database, value of last position
in the log file; else `None`'

@commitandrollback
def addLog(self, cur, jail, container):

    lastLinePos = None
    cur.execute('SELECT    firstlinemd5,    lastfilepos    FROM    logs    WHERE    jail=?    AND    path=?', (jail.name, container.getFileName()))
    try:
        (firstLineMD5, lastLinePos) = cur.fetchone()
    except TypeError:
        firstLineMD5 = False
    cur.execute('INSERT    OR    REPLACE    INTO    logs(jail,    path,    firstlinemd5,    lastfilepos)    VALUES(?,    ?,    ?,    ?)', (jail.name, container.getFileName(), container.getHash(), container.getPos()))
    if (container.getHash() != firstLineMD5):
        lastLinePos = None
    return lastLinePos
