'@param logger: the logger to log through.
@param level: the log level to emit events with.
@param encoding: The encoding to expect when receiving bytes via
C{write()}.  If L{None}, use C{sys.getdefaultencoding()}.
@type encoding: L{str}
@param log: The logger to send events to.
@type log: L{Logger}'

def __init__(self, logger, level=LogLevel.info, encoding=None):

    self.level = level
    self.log = logger
    if (encoding is None):
        self._encoding = sys.getdefaultencoding()
    else:
        self._encoding = encoding
    self._buffer = ''
    self._closed = False
