X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Floggable.py;h=cbaa116b6ad40f83ae3d7235e09eac09c235d94f;hp=d588a1d2a9fb36982dacb1b1a1347bec1fb009f5;hb=HEAD;hpb=f52cb7cfeb4e24febe7c66af3d5bb275a50d7f99 diff --git a/n2vc/loggable.py b/n2vc/loggable.py index d588a1d..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: @@ -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) )