summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/logging.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-04-29 17:22:50 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-04-29 17:22:50 +0000
commitd5f423fb1948be3cba52c37270dae6ef90be9dbb (patch)
tree4873d89d8146446c1cc08852893b78fc655e4fd8 /lib/sqlalchemy/logging.py
parenta74232c70cd8e3857646038900fc03edf63f0dd8 (diff)
downloadsqlalchemy-d5f423fb1948be3cba52c37270dae6ef90be9dbb.tar.gz
document the 'echo' property
Diffstat (limited to 'lib/sqlalchemy/logging.py')
-rw-r--r--lib/sqlalchemy/logging.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/sqlalchemy/logging.py b/lib/sqlalchemy/logging.py
index 665a5cff9..f02e3f746 100644
--- a/lib/sqlalchemy/logging.py
+++ b/lib/sqlalchemy/logging.py
@@ -67,15 +67,22 @@ def is_info_enabled(logger):
class echo_property(object):
level_map={logging.DEBUG : "debug", logging.INFO:True}
- __doc__ = "when ``True``, enable echoing for this element."
+ __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
level = logging.getLogger(_get_instance_name(instance)).getEffectiveLevel()
return echo_property.level_map.get(level, False)
def __set__(self, instance, value):
- if instance is None:
- return self
if value:
default_logging(_get_instance_name(instance))
logging.getLogger(_get_instance_name(instance)).setLevel(value == 'debug' and logging.DEBUG or logging.INFO)