summaryrefslogtreecommitdiff
path: root/logging_utils.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-07-08 22:25:12 -0700
committerScott Gasch <[email protected]>2021-07-08 22:25:12 -0700
commit11eeb8574b7b4620ac6fd440cb251f8aa2458f5b (patch)
tree97f8e64eddd4528b01af58df269427814b889929 /logging_utils.py
parente516059c716537259c601c022cc3bad44025385e (diff)
Reduce import scopes, remove cycles.
Diffstat (limited to 'logging_utils.py')
-rw-r--r--logging_utils.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/logging_utils.py b/logging_utils.py
index a24f1c9..ba5270f 100644
--- a/logging_utils.py
+++ b/logging_utils.py
@@ -12,8 +12,6 @@ import sys
import argparse_utils
import config
-import string_utils as su
-import thread_utils as tu
cfg = config.add_commandline_args(
f'Logging ({__file__})',
@@ -199,7 +197,8 @@ def get_logger(name: str = ""):
def tprint(*args, **kwargs) -> None:
if config.config['logging_debug_threads']:
- print(f'{tu.current_thread_id()}', end="")
+ from thread_utils import current_thread_id
+ print(f'{current_thread_id()}', end="")
print(*args, **kwargs)
else:
pass
@@ -258,6 +257,7 @@ class OutputSink(object):
self.destination_bitv = destination_bitv
def print(self, *args, **kwargs):
+ from string_utils import sprintf, strip_escape_sequences
end = kwargs.pop("end", None)
if end is not None:
if not isinstance(end, str):
@@ -268,7 +268,7 @@ class OutputSink(object):
raise TypeError("sep must be None or a string")
if kwargs:
raise TypeError("invalid keyword arguments to print()")
- buf = su.sprintf(*args, end="", sep=sep)
+ buf = sprintf(*args, end="", sep=sep)
if sep is None:
sep = " "
if end is None:
@@ -282,7 +282,7 @@ class OutputSink(object):
if self.destination_bitv & self.FILENAME and self.f is not None:
self.f.write(buf.encode('utf-8'))
self.f.flush()
- buf = su.strip_escape_sequences(buf)
+ buf = strip_escape_sequences(buf)
if self.logger is not None:
if self.destination_bitv & self.LOG_DEBUG:
self.logger.debug(buf)