Show running threads on shutdown handler

This commit is contained in:
norohind 2022-04-10 23:16:49 +03:00
parent 76ea80b178
commit 23ebf1b608
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -1,5 +1,5 @@
from loguru import logger
import threading
import time
import FAPI
@ -43,6 +43,8 @@ def shutdown_callback(sig: int, frame) -> None:
func = frame_info.function
code_line = frame_info.code_context[0]
logger.info(f'Currently at {func}:{frame_info.lineno}: {code_line!r}')
running_threads = ', '.join((thread.name for thread in threading.enumerate()))
logger.info(f'Running threads: {running_threads}')
except Exception as e:
logger.info(f"Can't detect where we are because {e}")