简体   繁体   中英

drf-yasg - testproj - how to silent all the debug output

How can I silent the debug statements for drf-yasg - testproj ? 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. Change log level to INFO for drf_yasg and django package there. like this

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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