--- a/bin/wsgi-dev.py Fri Dec 31 01:05:24 2010 +0200
+++ b/bin/wsgi-dev.py Fri Dec 31 02:26:32 2010 +0200
@@ -17,6 +17,7 @@
parser = optparse.OptionParser()
parser.add_option('-q', '--quiet', action='store_true', help='More output')
parser.add_option('-v', '--verbose', action='store_true', help='More output')
+ parser.add_option('-D', '--debug', action='store_true', help="Even more output (SQL queries)")
parser.add_option('-p', '--port', type='int', help='Local port to run on', default=8080, metavar='PORT')
parser.add_option('-B', '--bind', help="Local address to listen on", default='localhost', metavar='HOST')
@@ -26,15 +27,19 @@
(options, args) = parser.parse_args()
+ # defaults
+ level = logging.INFO
+ sql_echo = False
+
if options.quiet :
level = logging.WARN
- elif options.verbose :
+ if options.verbose :
level = logging.DEBUG
-
- else :
- # default
- level = logging.INFO
+
+ if options.debug :
+ level = logging.DEBUG
+ sql_echo = True
bind = options.bind
port = options.port
@@ -43,6 +48,10 @@
logging.basicConfig(format="[%(levelname)5s] %(funcName)25s : %(message)s", level=level)
+ if sql_echo :
+ # echo SQL queries
+ logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
+
# app state
application = svv.application.Application(
options.database,