binaryage / firelogger.py Goto Github PK
View Code? Open in Web Editor NEWPython library for FireLogger - a logger console integrated into Firebug
Home Page: http://firelogger.binaryage.com
License: Other
Python library for FireLogger - a logger console integrated into Firebug
Home Page: http://firelogger.binaryage.com
License: Other
Hi, it looks like your plugin breaks with firebug 1.4: https://addons.mozilla.org/it/firefox/addon/11090
Right now if the page does a submit, the logger pane gets cleared. It would be useful to have history available (for server side generated redirects mainly).
Iโm using it with pylons and emacs, and it totally kicks ass! Thanks for the awesome extension.
โ aaditya sood
FirePython add 'X-FirePython/0.1' to the user-agent string.
Some websites (eg. wordreference.com) prevent bot access blocking user-agent with 'Python' in the useragent string.
Exception exceptions.AttributeError: "'FirePythonWSGI' object has no attribute '_handler'" in <bound method FirePythonWSGI.del of <firepython.middleware.FirePythonWSGI object at 0x8704f4c>> ignored
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/servers/basehttp.py", line 279, in run
self.result = application(self.environ, self.start_response)
File "/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/servers/basehttp.py", line 651, in call
return self.application(environ, start_response)
File "/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/wsgi.py", line 230, in call
self.load_middleware()
File "/usr/lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/base.py", line 49, in load_middleware
mw_instance = mw_class()
TypeError: init() takes at least 2 arguments (1 given)
Using 0.7 on the client and 0.5 on the server
So for example if I log a URL that has a %20 in it:
http://myurl.com/someurl?key=my%20value
It shows up like this:
I'm using django (which support py23) it in a RHEL 4 and cannot upgrade python. Path follows:
--- firepython\middleware.py Tue May 12 10:12:32 2009 UTC
+++ firepython\middleware.py Tue Jun 16 22:06:02 2009 UTC
@@ -146,7 +146,7 @@
errors.append(self._handle_internal_exception(e))
chunks = self._encode(logs, errors, profile)
- guid = "%08x" % random.randint(0,0xFFFFFFFFL)
+ guid = "%08x" % random.randint(0,0xFFFFFFFF)
for i, chunk in enumerate(chunks):
add_header('FireLogger-%s-%d' % (guid, i), chunk)
@@ -356,17 +356,16 @@
self._start()
# run app
try:
- try:
- app = self._profile_wrap(self._app)
- app_iter = app(environ, faked_start_response)
- output = list(app_iter)
- except Exception:
- logging.exception(sys.exc_info()[1])
- raise
- except:
- logging.warning("DeprecationWarning: raising a string exception is deprecated")
- logging.exception(sys.exc_info()[0])
- raise
+ app = self._profile_wrap(self._app)
+ app_iter = app(environ, faked_start_response)
+ output = list(app_iter)
+ except Exception:
+ logging.exception(sys.exc_info()[1])
+ raise
+ except:
+ logging.warning("DeprecationWarning: raising a string exception is deprecated")
+ logging.exception(sys.exc_info()[0])
+ raise
finally:
# Output the profile first, so we can see any errors in profiling.
profile = self._prepare_profile()
Prepare tutorial page, so people can test-drive the extension.
Also explain difference between:
x = { ... }
logging.debug(x)
logging.debug("%s" % x)
logging.debug("%s", x)
Here is my config:
Django version: 1.2 alpha 1 - latest trunk
MIDDLEWARE_CLASSES: firepython.middleware.FirePythonWSGI
Server: Apache 2 on Ubuntu with mod_wsgi
django.wsgi:
import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__))) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
Traceback:
[Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] mod_wsgi (pid=12287): Exception occurred processing WSGI script '/home/sasha/Projects/django/django.wsgi'. [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] Traceback (most recent call last): [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] Traceback (most recent call last): [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 230, in __call__ [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 230, in __call__ [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] self.load_middleware() [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 49, in load_middleware [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] mw_instance = mw_class() [Mon Jan 25 23:39:16 2010] [error] [client 192.168.1.2] TypeError: __init__() takes at least 2 arguments (1 given)
I'm getting a FireLogger not detected message while running FireLogger on Mac with the Google App Engine Webapp framework. FireLogger is not receiving any messages from the application. Please see details below:
== System configuration == :
Mac OSX 10.6.6
Firefox 3.6.13
Firebug 1.6.1
Firelogger 0.9
FirePython api version 0.9
== Code: ==
import config
import cgi
import os
import sys
from firepython.middleware import FirePythonWSGI
import logging
....
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
...
def main():
application = webapp.WSGIApplication(
[('/', MainPage),
('/sign', Guestbook)],
debug=True)
application = FirePythonWSGI(application)
run_wsgi_app(application)
if name == "main":
main()
== Command Line Output == :
pigsy:dev alex$ dev_appserver.py --port=8080 helloworld/
INFO 2011-01-18 22:29:58,860 appengine_rpc.py:153] Server: appengine.google.com
INFO 2011-01-18 22:29:58,866 appcfg.py:414] Checking for updates to the SDK.
INFO 2011-01-18 22:30:01,452 appcfg.py:428] The SDK is up to date.
WARNING 2011-01-18 22:30:01,452 datastore_file_stub.py:573] Could not read datastore data from /var/folders/Uk/Uk4+q6Q4EpOZ0xEE4TqWFk+++TM/-Tmp-/dev_appserver.datastore
INFO 2011-01-18 22:30:01,579 dev_appserver_main.py:485] Running application helloworld on port 8080: http://localhost:8080
INFO 2011-01-18 22:30:04,731 config.py:9] Starting application in DEBUG mode: True
WARNING 2011-01-18 22:30:04,812 py_zipimport.py:103] Can't open zipfile /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg-info: IOError: [Errno 13] file not accessible: '/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg-info'
INFO 2011-01-18 22:30:05,024 middleware.py:61] FireLogger not detected
INFO 2011-01-18 22:30:05,039 dev_appserver.py:3317] "GET / HTTP/1.1" 200 -
INFO 2011-01-18 22:30:05,044 dev_appserver_index.py:212] Updating /Users/alex/Documents/dev/helloworld/index.yaml
INFO 2011-01-18 22:30:05,108 dev_appserver.py:3317] "GET /stylesheets/main.css HTTP/1.1" 200 -
I did the following:
My setup is the following:
Everything works fine without FirePython but I really want to use that great debug tool. When I add the 2 classes, all http request passed to manage.py timeout.
manage.py is up and running but seems to not handle any requests anymore.
Any help would be appreciated.
Laurent Luce
On trunk, the WSGI middleware fails for output_wrapper
Changing to:
output = list(app_iter)
from:
output = outer_wrapper(app_iter)
works
Since Firelogger 1.0 is on the way:
http://getsatisfaction.com/binaryage/topics/is_there_planned_upgrade_to_make_firelogger_compatible_with_firefox_4
FireLogger (client) has version "1.0", but FirePython (server) is version "0.9". Check http://firelogger.binaryage.com for latest version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.