summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/log.py')
-rw-r--r--lib/sqlalchemy/log.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/sqlalchemy/log.py b/lib/sqlalchemy/log.py
index a79b21e17..6b0b2e90e 100644
--- a/lib/sqlalchemy/log.py
+++ b/lib/sqlalchemy/log.py
@@ -24,15 +24,16 @@ import sys
# set initial level to WARN. This so that
# log statements don't occur in the absence of explicit
# logging being enabled for 'sqlalchemy'.
-rootlogger = logging.getLogger('sqlalchemy')
+rootlogger = logging.getLogger("sqlalchemy")
if rootlogger.level == logging.NOTSET:
rootlogger.setLevel(logging.WARN)
def _add_default_handler(logger):
handler = logging.StreamHandler(sys.stdout)
- handler.setFormatter(logging.Formatter(
- '%(asctime)s %(levelname)s %(name)s %(message)s'))
+ handler.setFormatter(
+ logging.Formatter("%(asctime)s %(levelname)s %(name)s %(message)s")
+ )
logger.addHandler(handler)
@@ -82,7 +83,7 @@ class InstanceLogger(object):
None: logging.NOTSET,
False: logging.NOTSET,
True: logging.INFO,
- 'debug': logging.DEBUG,
+ "debug": logging.DEBUG,
}
def __init__(self, echo, name):
@@ -91,8 +92,7 @@ class InstanceLogger(object):
# if echo flag is enabled and no handlers,
# add a handler to the list
- if self._echo_map[echo] <= logging.INFO \
- and not self.logger.handlers:
+ if self._echo_map[echo] <= logging.INFO and not self.logger.handlers:
_add_default_handler(self.logger)
#
@@ -174,12 +174,16 @@ def instance_logger(instance, echoflag=None):
"""create a logger for an instance that implements :class:`.Identified`."""
if instance.logging_name:
- name = "%s.%s.%s" % (instance.__class__.__module__,
- instance.__class__.__name__,
- instance.logging_name)
+ name = "%s.%s.%s" % (
+ instance.__class__.__module__,
+ instance.__class__.__name__,
+ instance.logging_name,
+ )
else:
- name = "%s.%s" % (instance.__class__.__module__,
- instance.__class__.__name__)
+ name = "%s.%s" % (
+ instance.__class__.__module__,
+ instance.__class__.__name__,
+ )
instance._echo = echoflag