diff options
author | Rob Crittenden <rcritten@redhat.com> | 2015-05-07 15:51:23 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2015-05-07 15:51:23 -0400 |
commit | c3cc4b620884e9e7935f87486131f18f5658292e (patch) | |
tree | 6e36cc50f79f8f96249079ebc023c40db8e18e99 /ipsilon/util/data.py | |
parent | 1bcc0d697dd37a9268641f0cbaa7e9e781552233 (diff) | |
download | ipsilon.git-logger.tar.gz ipsilon.git-logger.tar.xz ipsilon.git-logger.zip |
Add db.conn.log option to suppress sql logs by defaultlogger
The Store logging is quite verbose with a flurry of
init and destroy messages with each session. Setting
db.conn.log to False (default) will suppress these. If one
needs to do connection tracing it can be enabled.
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Diffstat (limited to 'ipsilon/util/data.py')
-rw-r--r-- | ipsilon/util/data.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index eec00b5..26fa859 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -37,11 +37,13 @@ class SqlStore(Log): @classmethod def get_connection(cls, name): if name not in cls.__instances.keys(): - logging.debug('SqlStore new: %s', name) + if cherrypy.config.get('db.conn.log', False): + logging.debug('SqlStore new: %s', name) cls.__instances[name] = SqlStore(name) return cls.__instances[name] def __init__(self, name): + self.db_conn_log = cherrypy.config.get('db.conn.log', False) self.debug('SqlStore init: %s' % name) self.name = name engine_name = name @@ -61,6 +63,10 @@ class SqlStore(Log): self._dbengine = create_engine(engine_name, **pool_args) self.is_readonly = False + def debug(self, fact): + if self.db_conn_log: + super(SqlStore, self).debug(fact) + def engine(self): return self._dbengine |