def log_to_stream(stream=sys.stderr, level=logging.NOTSET,<EOL>fmt=logging.BASIC_FORMAT):
fmt = Formatter(fmt)<EOL>handler = StreamHandler()<EOL>handler.setFormatter(fmt)<EOL>handler.setLevel(level)<EOL>log.addHandler(handler)<EOL>
Add :class:`logging.StreamHandler` to logger which logs to a stream.

    :param stream. Stream to log to, default STDERR.
    :param level: Log level, default NOTSET.
    :param fmt: String with log format, default is BASIC_FORMAT.