FirePHP

FirePHP is a (somewhat badly named)  Firebug extension for Firefox that can show server-side log messages and data relating to a request directly in the Firebug console in the browser.

See the  FirePHP web site for more information.

Diva provides basic support for sending log messages to FirePHP. I'm thinking about also exposing the template data, and in general providing a function for apps to dump data to FirePHP.

Screenshot

This functionality is implemented by the module diva.ext.firephp. It requires  simplejson to be installed for Python versions prior to 2.6.

It is implemented by a custom logging handler for the  logging package from the standard library. FirePHP logging is enabled by default when you use the DevelopmentServer, but is also easy to add for other kinds of deployments, for example:

import logging
from diva.ext.firephp import FirePHPHandler

logging.root.setLevel(logging.DEBUG)

logfile = logging.FileHandler('/var/log/myapp/python.log')
logfile.setLevel(log_level)
logfile.setFormatter(logging.Formatter('%(asctime)s %(levelname)-8s %(message)s'))
logging.root.addHandler(logfile)

firephp = FirePHPHandler()
firephp.setLevel(logging.DEBUG)
logging.root.addHandler(firephp)

Attachments