'Writes data only if it constitutes a whole line. If it\'s not the case,
store it in a buffer and wait until we have a complete line.
:param data - Raw data (a string) that will be processed.'

@do_not_report_as_logging_caller
def write(self, data):

    data_lines = data.split('\n')
    if (len(data_lines) > 1):
        self._buffer.append(data_lines[0])
        self._flush_buffer()
    for line in data_lines[1:(-1)]:
        self._log_line(line)
    if data_lines[(-1)]:
        self._buffer.append(data_lines[(-1)])
