views:

355

answers:

1

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 I can't find any more information then that. I don't really want to log to a file but to the info pane on the toolbar. How does this work?

+7  A: 

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')
jonwd7