aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/pytest/plugins/ya.py
diff options
context:
space:
mode:
authordvshkurko <dvshkurko@yandex-team.ru>2022-02-10 16:45:51 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:51 +0300
commit321ee9bce31ec6e238be26dbcbe539cffa2c3309 (patch)
tree14407a2757cbf29eb97e266b7f07e851f971000c /library/python/pytest/plugins/ya.py
parent2f6ca198245aeffd5e2d82b65927c2465b68b4f5 (diff)
downloadydb-321ee9bce31ec6e238be26dbcbe539cffa2c3309.tar.gz
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/python/pytest/plugins/ya.py')
-rw-r--r--library/python/pytest/plugins/ya.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/library/python/pytest/plugins/ya.py b/library/python/pytest/plugins/ya.py
index 1bde03042d..60bb08cfeb 100644
--- a/library/python/pytest/plugins/ya.py
+++ b/library/python/pytest/plugins/ya.py
@@ -98,31 +98,31 @@ class YaTestLoggingFileHandler(logging.FileHandler):
pass
-class _TokenFilterFormatter(logging.Formatter):
- def __init__(self, fmt):
- super(_TokenFilterFormatter, self).__init__(fmt)
- self._replacements = []
- if not self._replacements:
- if six.PY2:
- for k, v in os.environ.iteritems():
- if k.endswith('TOKEN') and v:
- self._replacements.append(v)
- elif six.PY3:
- for k, v in os.environ.items():
- if k.endswith('TOKEN') and v:
- self._replacements.append(v)
- self._replacements = sorted(self._replacements)
-
- def _filter(self, s):
- for r in self._replacements:
- s = s.replace(r, "[SECRET]")
-
- return s
-
- def format(self, record):
- return self._filter(super(_TokenFilterFormatter, self).format(record))
-
-
+class _TokenFilterFormatter(logging.Formatter):
+ def __init__(self, fmt):
+ super(_TokenFilterFormatter, self).__init__(fmt)
+ self._replacements = []
+ if not self._replacements:
+ if six.PY2:
+ for k, v in os.environ.iteritems():
+ if k.endswith('TOKEN') and v:
+ self._replacements.append(v)
+ elif six.PY3:
+ for k, v in os.environ.items():
+ if k.endswith('TOKEN') and v:
+ self._replacements.append(v)
+ self._replacements = sorted(self._replacements)
+
+ def _filter(self, s):
+ for r in self._replacements:
+ s = s.replace(r, "[SECRET]")
+
+ return s
+
+ def format(self, record):
+ return self._filter(super(_TokenFilterFormatter, self).format(record))
+
+
def setup_logging(log_path, level=logging.DEBUG, *other_logs):
logs = [log_path] + list(other_logs)
root_logger = logging.getLogger()
@@ -133,7 +133,7 @@ def setup_logging(log_path, level=logging.DEBUG, *other_logs):
for log_file in logs:
file_handler = YaTestLoggingFileHandler(log_file)
log_format = '%(asctime)s - %(levelname)s - %(name)s - %(funcName)s: %(message)s'
- file_handler.setFormatter(_TokenFilterFormatter(log_format))
+ file_handler.setFormatter(_TokenFilterFormatter(log_format))
file_handler.setLevel(level)
root_logger.addHandler(file_handler)