summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/logging.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-22 16:58:26 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-22 16:58:26 +0000
commite2bb1503bf2b8ec5cd35206ec8e77f14d249f130 (patch)
treec19682cafd196473cfa45052e1375dd4e65fa35d /lib/sqlalchemy/logging.py
parentea44deff14a59da731ffeeafbbcf721921f1404d (diff)
downloadsqlalchemy-e2bb1503bf2b8ec5cd35206ec8e77f14d249f130.tar.gz
- restored engine.echo flag
- changelog
Diffstat (limited to 'lib/sqlalchemy/logging.py')
-rw-r--r--lib/sqlalchemy/logging.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/sqlalchemy/logging.py b/lib/sqlalchemy/logging.py
index 2dfd1e50a..2ced66109 100644
--- a/lib/sqlalchemy/logging.py
+++ b/lib/sqlalchemy/logging.py
@@ -75,4 +75,23 @@ def instance_logger(instance, echoflag=None):
instance._should_log_debug = l.isEnabledFor(logging.DEBUG)
instance._should_log_info = l.isEnabledFor(logging.INFO)
return l
+
+class echo_property(object):
+ __doc__ = """when ``True``, enable log output for this element.
+
+ This has the effect of setting the Python logging level for the
+ namespace of this element's class and object reference. A value
+ of boolean ``True`` indicates that the loglevel ``logging.INFO`` will be
+ set for the logger, whereas the string value ``debug`` will set the loglevel
+ to ``logging.DEBUG``.
+ """
+
+ def __get__(self, instance, owner):
+ if instance is None:
+ return self
+ else:
+ return instance._should_log_debug and 'debug' or (instance._should_log_info and True or False)
+
+ def __set__(self, instance, value):
+ instance_logger(instance, echoflag=value)
\ No newline at end of file