X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Floggable.py;h=d129b4b6757b4ef64a4a3d069a0dd7487c6e7e18;hp=b3b98da87a736526e45c54f4bafa3fc7402c7312;hb=HEAD;hpb=5ab1064304b993ea6364b5d932c5c0cb7434cfb7 diff --git a/n2vc/loggable.py b/n2vc/loggable.py index b3b98da..d129b4b 100644 --- a/n2vc/loggable.py +++ b/n2vc/loggable.py @@ -31,7 +31,6 @@ import time class Loggable: def __init__(self, log, log_to_console: bool = False, prefix: str = ""): - self._last_log_time = None # used for time increment in logging self._log_to_console = log_to_console self._prefix = prefix @@ -93,7 +92,6 @@ class Loggable: include_thread: bool = False, include_coroutine: bool = True, ) -> str: - # time increment from last log now = time.perf_counter() if self._last_log_time is None: @@ -115,7 +113,7 @@ class Loggable: if not include_path: i = filename.rfind("/") if i > 0: - filename = filename[i + 1:] + filename = filename[i + 1 :] # datetime dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f") @@ -133,7 +131,7 @@ class Loggable: coroutine_id = "" if include_coroutine: try: - if asyncio.Task.current_task() is not None: + if asyncio.current_task() is not None: def print_cor_name(c): import inspect @@ -145,7 +143,7 @@ class Loggable: except Exception: pass - coro = asyncio.Task.current_task()._coro + coro = asyncio.current_task()._coro coroutine_id = "coro-{} {}()".format( hex(id(coro))[2:], print_cor_name(coro) )