def log(self, message, level=None):
if level is None:<EOL><INDENT>_log_level = logging.INFO<EOL><DEDENT>else:<EOL><INDENT>if level == "<STR_LIT>" or level == "<STR_LIT>":<EOL><INDENT>_log_level = logging.DEBUG<EOL><DEDENT>elif level == "<STR_LIT:info>":<EOL><INDENT>_log_level = logging.INFO<EOL><DEDENT>elif level == "<STR_LIT>":<EOL><INDENT>_log_level = logging.WARNING<EOL><DEDENT>elif level == "<STR_LIT:error>":<EOL><INDENT>_log_level = logging.ERROR<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % str(level))<EOL><DEDENT><DEDENT>self.logger.log(_log_level, message)<EOL>
Log message, optionally providing a logging level

        It is compatible with StreamParse API.

        :type message: str
        :param message: the log message to send
        :type level: str
        :param level: the logging level,
                      one of: trace (=debug), debug, info, warn or error (default: info)