diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-24 23:59:22 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-24 23:59:22 +0000 |
commit | e812785c2d7985382458ca8dd7b2409b58c38eb2 (patch) | |
tree | 02ccb8af8dee7d987738d35eeefbb5106dc67927 /lib/sqlalchemy/util.py | |
parent | 7daa9e1d6a0bddf46cbd47115b5f5a4ef56ce478 (diff) | |
download | sqlalchemy-e812785c2d7985382458ca8dd7b2409b58c38eb2.tar.gz |
- logging is now implemented via standard python "logging" module.
"echo" keyword parameters are still functional but set/unset
log levels for their respective classes/instances. all logging
can be controlled directly through the Python API by setting
INFO and DEBUG levels for loggers in the "sqlalchemy" namespace.
class-level logging is under "sqlalchemy.<module>.<classname>",
instance-level logging under "sqlalchemy.<module>.<classname>.<hexid>".
Test suite includes "--log-info" and "--log-debug" arguments
which work independently of --verbose/--quiet. Logging added
to orm to allow tracking of mapper configurations, row iteration
fixes [ticket:229] [ticket:79]
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r-- | lib/sqlalchemy/util.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 1778966d4..3664b8e6d 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -72,33 +72,6 @@ class SimpleProperty(object): else: return getattr(obj, self.key) -class Logger(object): - """defines various forms of logging""" - def __init__(self, logger=None, usethreads=False, usetimestamp=True, origin=None): - self.logger = logger or sys.stdout - self.usethreads = usethreads - self.usetimestamp = usetimestamp - self.origin = origin - def write(self, msg): - if self.usetimestamp: - t = time.time() - ms = (t - long(t)) * 1000 - timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(t)) - timestamp = "[%s,%03d]" % (timestamp, ms) - else: - timestamp = None - if self.origin: - origin = "[%s]" % self.origin - origin = "%-8s" % origin - else: - origin = None - if self.usethreads: - threadname = threading.currentThread().getName() - threadname = "[" + threadname + ' '*(8-len(threadname)) + "]" - else: - threadname = None - self.logger.write(string.join([s for s in (timestamp, threadname, origin) if s is not None]) + ": " + msg + "\n") - class OrderedProperties(object): """ An object that maintains the order in which attributes are set upon it. |