'Log the given message.
@param string: Data to write.
@type string: L{bytes} in this file\'s preferred encoding or L{unicode}'

def write(self, string):

    if self._closed:
        raise ValueError('I/O    operation    on    closed    file')
    if isinstance(string, bytes):
        string = string.decode(self._encoding)
    lines = (self._buffer + string).split('\n')
    self._buffer = lines[(-1)]
    lines = lines[0:(-1)]
    for line in lines:
        self.log.emit(self.level, format=u'{log_io}', log_io=line)
