def emit(self, level, message, prefix=None, color=None):
if color is None:<EOL><INDENT>color = level<EOL><DEDENT>if prefix is not None:<EOL><INDENT>prefix = self.addColor(color, "<STR_LIT>" % (prefix))<EOL><DEDENT>else:<EOL><INDENT>prefix = "<STR_LIT>"<EOL>message = self.addColor(color, message)<EOL><DEDENT>message = "<STR_LIT>" % (prefix, message)<EOL>if not message.endswith('<STR_LIT:\n>'):<EOL><INDENT>message = "<STR_LIT>" % message<EOL><DEDENT>if self.level == QUIET:<EOL><INDENT>pass<EOL><DEDENT>elif self.isEnabledFor(level):<EOL><INDENT>if self.emitError(level):<EOL><INDENT>self.write(self.errorStream, message)<EOL><DEDENT>else:<EOL><INDENT>self.write(self.outputStream, message)<EOL><DEDENT><DEDENT>self.history.append(message)<EOL>
emit is the main function to print the message
        optionally with a prefix
        :param level: the level of the message
        :param message: the message to print
        :param prefix: a prefix for the message