1

我是hypercorn++的uvloop新手quart。我正在尝试创建以下文件并在路由处理程序中打印一些信息/调试日志,但没有显示任何内容。我已经调试到路由处理程序并注意到dog_server.logger.disabled = True. 有谁知道是什么问题?谢谢!

狗蓝图.py

from quart import Blueprint
import logging

logging.basicConfig(level=logging.DEBUG)

class DogBlueprint(Blueprint):
    logger = None
    app_config = None

    def register(self, app, options, first_registration: bool = False):
        # app.logger.info('DogBlueprint is registering')
        print('Blueprint registering...')
        self.logger = app.logger 
        self.logger.info("Hello")  # This one working fine
        self.app_config = app.config
        super(DogBlueprint, self).register(app, options, first_registration)
        self.logger.info("World")  # This one working fine

路线.py

dog_server = DogBlueprint('dog_server', __name__)
logging.basicConfig(level=logging.DEBUG)

@dog_server.route('/score', methods=['POST'])
async def post_handler():
    received = await _fetch_post_body(request)
    dog_server.logger.info(f'Received size: {len(received)}')  # This one does not work
    ... ... 
4

1 回答 1

1

这是 Hypercorn 中的一个错误,请参阅此讨论。我会避免使用 0.11.0 并使用 0.10.2 或 0.11.1。(我是 Hypercorn 作者)。

于 2020-10-05T17:15:11.650 回答