[llvm-commits] [LNT] r154713 - /lnt/trunk/lnt/lnttool/create.py
Daniel Dunbar
daniel at zuster.org
Fri Apr 13 16:36:10 PDT 2012
Author: ddunbar
Date: Fri Apr 13 18:36:10 2012
New Revision: 154713
URL: http://llvm.org/viewvc/llvm-project?rev=154713&view=rev
Log:
lnt create: Add a --show-sql option.
Modified:
lnt/trunk/lnt/lnttool/create.py
Modified: lnt/trunk/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/create.py?rev=154713&r1=154712&r2=154713&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/create.py (original)
+++ lnt/trunk/lnt/lnttool/create.py Fri Apr 13 18:36:10 2012
@@ -1,4 +1,5 @@
import hashlib
+import logging
import os
import platform
import random
@@ -110,6 +111,9 @@
parser.add_option("", "--hostsuffix", dest="hostsuffix", default="perf",
help="suffix at which WSGI app lives [%default]",
metavar="NAME")
+ parser.add_option("", "--show-sql", dest="show_sql", action="store_true",
+ help="show SQL statements executed during construction",
+ default=False)
(opts, args) = parser.parse_args(args)
if len(args) != 1:
@@ -117,6 +121,22 @@
path, = args
+ # Setup the base LNT logger.
+ logger = logging.getLogger("lnt")
+ logger.setLevel(logging.WARNING)
+ handler = logging.StreamHandler(sys.stderr)
+ handler.setFormatter(logging.Formatter(
+ '%(asctime)s %(levelname)s: %(message)s',
+ datefmt='%Y-%m-%d %H:%M:%S'))
+ logger.addHandler(handler)
+
+ # Enable full SQL logging, if requested.
+ if opts.show_sql:
+ sa_logger = logging.getLogger("sqlalchemy")
+ sa_logger.setLevel(logging.INFO)
+ sa_logger.addHandler(handler)
+
+ # Set up locals we use later for substitution.
name = opts.name
config = opts.config
wsgi = opts.wsgi
More information about the llvm-commits
mailing list