'Writes a new entry to the log
@param repository_id: the repository record ID
@param resource_name: the resource name
@param transmission: transmission mode (IN, OUT or None)
@param mode: synchronization mode (PULL, PUSH or None)
@param action: action that triggers the log entry (if any)
@param result: the result of the transaction
(SUCCESS, WARNING, ERROR or FATAL)
@param remote: boolean, True if this is a remote error
@param message: clear text message'

@classmethod
def write(cls, repository_id=None, resource_name=None, transmission=None, mode=None, action=None, result=None, remote=False, message=None):

    if (result not in (cls.SUCCESS, cls.WARNING, cls.ERROR, cls.FATAL)):
        result = cls.SUCCESS
    if (result == cls.SUCCESS):
        remote = False
    if (transmission not in (cls.IN, cls.OUT)):
        transmission = cls.NONE
    if (mode not in (cls.PULL, cls.PUSH, cls.LOGIN, cls.REGISTER)):
        mode = cls.NONE
    if (not action):
        action = cls.NONE
    entry = {'timestmp': datetime.datetime.utcnow(), 'repository_id': repository_id, 'resource_name': resource_name, 'mode': ('%s/%s' % (mode, transmission)), 'action': action, 'result': result, 'remote': remote, 'message': message}
    current.s3db[cls.TABLENAME].insert(**entry)
