summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/log.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:14:26 -0500
committermike bayer <mike_mp@zzzcomputing.com>2019-01-06 17:34:50 +0000
commit1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch)
tree28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/log.py
parent404e69426b05a82d905cbb3ad33adafccddb00dd (diff)
downloadsqlalchemy-1e1a38e7801f410f244e4bbb44ec795ae152e04e.tar.gz
Run black -l 79 against all source files
This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
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