summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-22 18:08:10 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-22 18:08:10 +0000
commitd3917532bc9c2a37158596055028d95e710fff91 (patch)
treefdcd43d596f1de9a56b2d005eea91ff2b4f13aab
parent37b9857f4d97d7555cb291da88f7408fc026a394 (diff)
downloadsqlalchemy-d3917532bc9c2a37158596055028d95e710fff91.tar.gz
- tightened down the screws on logging a little bit
-rw-r--r--lib/sqlalchemy/engine/base.py14
-rw-r--r--lib/sqlalchemy/logging.py9
-rw-r--r--test/engine/parseconnect.py2
3 files changed, 13 insertions, 12 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index c13c1d946..496af751b 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -672,7 +672,8 @@ class Connection(Connectable):
def _begin_impl(self):
if self.__connection.is_valid:
- self.__engine.logger.info("BEGIN")
+ if self.__engine._should_log_info:
+ self.__engine.logger.info("BEGIN")
try:
self.__engine.dialect.do_begin(self.connection)
except Exception, e:
@@ -680,7 +681,8 @@ class Connection(Connectable):
def _rollback_impl(self):
if self.__connection.is_valid:
- self.__engine.logger.info("ROLLBACK")
+ if self.__engine._should_log_info:
+ self.__engine.logger.info("ROLLBACK")
try:
self.__engine.dialect.do_rollback(self.connection)
except Exception, e:
@@ -689,7 +691,8 @@ class Connection(Connectable):
def _commit_impl(self):
if self.__connection.is_valid:
- self.__engine.logger.info("COMMIT")
+ if self.__engine._should_log_info:
+ self.__engine.logger.info("COMMIT")
try:
self.__engine.dialect.do_commit(self.connection)
except Exception, e:
@@ -1168,11 +1171,6 @@ class Engine(Connectable):
return self.pool.unique_connection()
- def log(self, msg):
- """Log a message using this SQLEngine's logger stream."""
-
- self.logger.info(msg)
-
class ResultProxy(object):
"""Wraps a DB-API cursor object to provide easier access to row columns.
diff --git a/lib/sqlalchemy/logging.py b/lib/sqlalchemy/logging.py
index 2ced66109..caaecf302 100644
--- a/lib/sqlalchemy/logging.py
+++ b/lib/sqlalchemy/logging.py
@@ -66,10 +66,15 @@ def is_info_enabled(logger):
return logger.isEnabledFor(logging.INFO)
def instance_logger(instance, echoflag=None):
- if echoflag:
+ if echoflag is not None:
default_logging(_get_instance_name(instance))
l = logging.getLogger(_get_instance_name(instance))
- l.setLevel(echoflag == 'debug' and logging.DEBUG or logging.INFO)
+ if echoflag == 'debug':
+ l.setLevel(logging.DEBUG)
+ elif echoflag is True:
+ l.setLevel(logging.INFO)
+ elif echoflag is False:
+ l.setLevel(logging.NOTSET)
else:
l = logging.getLogger(_get_instance_name(instance))
instance._should_log_debug = l.isEnabledFor(logging.DEBUG)
diff --git a/test/engine/parseconnect.py b/test/engine/parseconnect.py
index 035a8d9cf..157afeb2f 100644
--- a/test/engine/parseconnect.py
+++ b/test/engine/parseconnect.py
@@ -57,13 +57,11 @@ class CreateEngineTest(PersistTest):
config = {
'sqlalchemy.url':'postgres://scott:tiger@somehost/test?fooz=somevalue',
- 'sqlalchemy.echo':'1',
'sqlalchemy.pool_recycle':50
}
e = engine_from_config(config, module=dbapi)
assert e.pool._recycle == 50
- assert e.echo is True
assert e.url == url.make_url('postgres://scott:tiger@somehost/test?fooz=somevalue')
def test_custom(self):