繁体   English   中英

drf-yasg-testproj-如何使所有调试输出静音

[英]drf-yasg - testproj - how to silent all the debug output

如何使drf-yasg-testproj的调试语句静音? https://github.com/axnsan12/drf-yasg

这是我的设置方式:

$ git clone https://github.com/axnsan12/drf-yasg.git
$ cd drf-yasg
$ virtualenv venv
$ source venv/bin/activate
(venv) $ cd testproj
(venv) $ python -m pip install -U pip setuptools
(venv) $ pip install -U -r requirements.txt
(venv) $ python manage.py migrate
(venv) $ python manage.py runserver
(venv) $ firefox localhost:8000/swagger/

但是它不断产生大量调试打印信息,这使我很难测试某些功能。 如何使这些调试打印静音? 谢谢。

这是调试打印:

2019-09-14 08:02:10,769 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/coreapi/exceptions.py first seen with mtime 1568447198.368635
2019-09-14 08:02:10,769 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/rest_framework/relations.py first seen with mtime 1568447200.446008
2019-09-14 08:02:10,769 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/requests/certs.py first seen with mtime 1568447203.023515
2019-09-14 08:02:10,769 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/coreapi/compat.py first seen with mtime 1568447198.368073
2019-09-14 08:02:10,770 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/rest_framework/utils/model_meta.py first seen with mtime 1568447200.529353
2019-09-14 08:02:10,770 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/django/contrib/auth/middleware.py first seen with mtime 1568447201.356465
2019-09-14 08:02:10,770 | DEBUG | django.utils.autoreload | File /Users/axil/Documents/project/unrealpower/unrealpower_upgrade_v2/testdrf/drvenv/lib/python3.6/site-packages/rest_framework/renderers.py first seen with mtime 1568447200.446478

testproj/testproj/settings/base.py文件中为此测试项目配置了日志设置。 drf_yasg和django软件包的日志级别更改为INFO 像这样

   'drf_yasg': {
        'handlers': ['console_log'],
        'level': 'INFO',
        'propagate': False,
    },

    'django': {
        'handlers': ['console_log'],
        'level': 'INFO',
        'propagate': False,
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM