aboutsummaryrefslogtreecommitdiffstats
path: root/yt/python
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-03-28 18:47:43 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-03-28 18:58:09 +0300
commit369e2759174a2e7a4542fb4366ee0b9ec45b3f5a (patch)
tree1c248f21212cddb2f42bea258b2568a8f50de0a5 /yt/python
parent3ef7b38056eaa1deece0f74575691b23f01ecc05 (diff)
downloadydb-369e2759174a2e7a4542fb4366ee0b9ec45b3f5a.tar.gz
Intermediate changes
Diffstat (limited to 'yt/python')
-rw-r--r--yt/python/yt/logger.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yt/python/yt/logger.py b/yt/python/yt/logger.py
index 7b876312b9..d2007eaca3 100644
--- a/yt/python/yt/logger.py
+++ b/yt/python/yt/logger.py
@@ -39,10 +39,11 @@ class SimpleColorizedStreamHandler(logging.StreamHandler):
RE_KW = functools.partial(lambda p, r, m: p.sub(r, m), re.compile(r"(Perform HTTP \S+ request|Response received)"), r"{}\1{}".format(KW, C_END))
RE_HTTP = functools.partial(lambda p, r, m: p.sub(r, m), re.compile(r"(https?://\S+)"), r"{}\1{}".format(URL, C_END))
- RE_JSON = functools.partial(lambda p, r, m: p.sub(r, m), re.compile(r"([\w'-]+): "), r"{}\1{}: ".format(PARAM, C_END))
+ RE_JSON = functools.partial(lambda p, r, m: p.sub(r, m), re.compile(r"(['\"][\w-]+['\"]): ?"), r"{}\1{}: ".format(PARAM, C_END))
RE_YSON = functools.partial(lambda p, r, m: p.sub(r, m), re.compile(r"\"([^\";]+?)\"="), "\"{}\\1{}\"=".format(YSON_PARAM, C_END))
- ENABLED = os.environ.get("YT_LOG_LEVEL") == "Debug"
+ # to disable color output
+ DISABLE_COLOR = os.environ.get("YT_LOG_LEVEL") == "Debug"
terminator = '\n' # py2 compat
@@ -57,7 +58,7 @@ class SimpleColorizedStreamHandler(logging.StreamHandler):
try:
msg = self.format(record)
stream = self.stream
- if stream.isatty() and record.levelno == logging.DEBUG and self.ENABLED:
+ if stream.isatty() and record.levelno == logging.DEBUG and not self.DISABLE_COLOR:
msg = self._colorize(msg)
stream.write(msg + self.terminator)
self.flush()