diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-28 17:43:10 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-28 17:43:10 +0000 |
commit | ba015e62cc1c688b11a7b8f916867f123a6fe206 (patch) | |
tree | e88563a37f0e4b60484986d55b3ad03903fe7232 /lib/sqlalchemy/log.py | |
parent | 3328792ebcc6af92c9c4e486e755a43300f6a279 (diff) | |
download | sqlalchemy-ba015e62cc1c688b11a7b8f916867f123a6fe206.tar.gz |
- orm: Removed a lot of logging that nobody really cares about,
logging that remains will respond to live changes in the
log level. No significant overhead is added. [ticket:1719]
- engine: Opened up logging a bit such that isEnabledFor() is called
more often, so that changes to the log level for engine/pool
will be reflected on next connect. This adds a small
amount of method call overhead. It's negligible and will make
life a lot easier for all those situations when logging
just happens to be configured after create_engine() is called.
[ticket:1719]
Diffstat (limited to 'lib/sqlalchemy/log.py')
-rw-r--r-- | lib/sqlalchemy/log.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/sqlalchemy/log.py b/lib/sqlalchemy/log.py index 62e0739f7..eac90854c 100644 --- a/lib/sqlalchemy/log.py +++ b/lib/sqlalchemy/log.py @@ -53,17 +53,11 @@ def class_logger(cls, enable=False): logger.setLevel(logging.DEBUG) elif enable == 'info': logger.setLevel(logging.INFO) - cls._should_log_debug = logger.isEnabledFor(logging.DEBUG) - cls._should_log_info = logger.isEnabledFor(logging.INFO) + cls._should_log_debug = lambda self: logger.isEnabledFor(logging.DEBUG) + cls._should_log_info = lambda self: logger.isEnabledFor(logging.INFO) cls.logger = logger _logged_classes.add(cls) -def _refresh_class_loggers(): - for cls in _logged_classes: - logger = logging.getLogger(cls.__module__ + "." + cls.__name__) - cls._should_log_debug = logger.isEnabledFor(logging.DEBUG) - cls._should_log_info = logger.isEnabledFor(logging.INFO) - def instance_logger(instance, echoflag=None): """create a logger for an instance. @@ -93,8 +87,8 @@ def instance_logger(instance, echoflag=None): l.setLevel(logging.WARN) else: l = logging.getLogger(name) - instance._should_log_debug = l.isEnabledFor(logging.DEBUG) - instance._should_log_info = l.isEnabledFor(logging.INFO) + instance._should_log_debug = lambda: l.isEnabledFor(logging.DEBUG) + instance._should_log_info = lambda: l.isEnabledFor(logging.INFO) return l class echo_property(object): |