diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-01 23:15:53 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-01 23:15:53 +0000 |
commit | 7a2194e6c0c392ea50fb8b325acb27f8a98428f9 (patch) | |
tree | 32d782cedb2bc9e9276abfdb00acfea2175ecb7c /lib/sqlalchemy/logging.py | |
parent | 8d3a76aac98b6b1150c2c38063af41668d9c4d76 (diff) | |
download | sqlalchemy-7a2194e6c0c392ea50fb8b325acb27f8a98428f9.tar.gz |
- added profiling to massave
- adjusted the formatting for per-instance loggers to limit the number
of loggers that get created in memory.
Diffstat (limited to 'lib/sqlalchemy/logging.py')
-rw-r--r-- | lib/sqlalchemy/logging.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/logging.py b/lib/sqlalchemy/logging.py index bba1e0764..bbd008dac 100644 --- a/lib/sqlalchemy/logging.py +++ b/lib/sqlalchemy/logging.py @@ -40,8 +40,10 @@ def default_logging(): handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s')) rootlogger.addHandler(handler) -def _get_instance_name(instance): - return instance.__class__.__module__ + "." + instance.__class__.__name__ + "." + hex(id(instance)) +def _get_instance_name(instance): + # since getLogger() does not have any way of removing logger objects from memory, + # instance logging displays the instance id as a modulus of 10 to prevent endless memory growth + return instance.__class__.__module__ + "." + instance.__class__.__name__ + ".0x.." + hex(id(instance))[-2:] def instance_logger(instance): return logging.getLogger(_get_instance_name(instance)) |