How do I use Logging in the Django Debug Toolbar?

前端 未结 3 471
别跟我提以往
别跟我提以往 2021-02-02 06:09

I would like to output debug messages in my django app at different points in a view function. The docs for the django-debug-toolbar say it uses the build in python logging but

3条回答
  •  长发绾君心
    2021-02-02 07:02

    You just use the logging module methods and DjDT will intercept and display them in the Logging Panel.

    import logging
    
    logging.debug('Debug Message')
    
    if some_error:
       logging.error('Error Message')
    

提交回复
热议问题