'A dictionary that should be logged if this message is served.'

def log(self, settings):

    ret = {}
    for i in self.logattrs:
        v = getattr(self, i)
        if hasattr(v, 'values'):
            v = [x[:LOG_TRUNCATE] for x in v.values(settings)]
            v = strutils.bytes_to_escaped_str(''.join(v))
        elif hasattr(v, '__len__'):
            v = v[:LOG_TRUNCATE]
            v = strutils.bytes_to_escaped_str(v)
        ret[i] = v
    ret['spec'] = self.spec()
    return ret
