简体   繁体   English

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

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

How can I silent the debug statements for drf-yasg - testproj ? 如何使drf-yasg-testproj的调试语句静音? https://github.com/axnsan12/drf-yasg https://github.com/axnsan12/drf-yasg

This is how I set it up: 这是我的设置方式:

$ 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/

But it keeps producing a lot of debug prints which makes it difficult for me test certain features. 但是它不断产生大量调试打印信息,这使我很难测试某些功能。 How do I silent these debug prints ? 如何使这些调试打印静音? Thanks. 谢谢。

Here are the debug prints: 这是调试打印:

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

Logging settings are configured for this test project in testproj/testproj/settings/base.py file. testproj/testproj/settings/base.py文件中为此测试项目配置了日志设置。 Change log level to INFO for drf_yasg and django package there. drf_yasg和django软件包的日志级别更改为INFO like this 像这样

   '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