Add a `thread_ui: str` to record headers
parent
7a1f0a0128
commit
7d2922dfb7
|
|
@ -38,6 +38,7 @@ from logging import (
|
||||||
Logger,
|
Logger,
|
||||||
StreamHandler,
|
StreamHandler,
|
||||||
)
|
)
|
||||||
|
import threading
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
@ -60,7 +61,7 @@ LOG_FORMAT: str = (
|
||||||
"{log_color}{asctime}{reset}"
|
"{log_color}{asctime}{reset}"
|
||||||
" {bold_white}{thin_white}({reset}"
|
" {bold_white}{thin_white}({reset}"
|
||||||
"{thin_white}{actor_name}[{actor_uid}], "
|
"{thin_white}{actor_name}[{actor_uid}], "
|
||||||
"{process}, {task}){reset}{bold_white}{thin_white})"
|
"{process}, {thread_uid}, {task_uid}){reset}{bold_white}{thin_white})"
|
||||||
" {reset}{log_color}[{reset}{bold_log_color}{levelname}{reset}{log_color}]"
|
" {reset}{log_color}[{reset}{bold_log_color}{levelname}{reset}{log_color}]"
|
||||||
" {log_color}{name}"
|
" {log_color}{name}"
|
||||||
" {thin_white}{filename}{log_color}:{reset}{thin_white}{lineno}{log_color}"
|
" {thin_white}{filename}{log_color}:{reset}{thin_white}{lineno}{log_color}"
|
||||||
|
|
@ -284,16 +285,26 @@ def pformat_task_uid(
|
||||||
return f'{task.name}[{tid_part}]'
|
return f'{task.name}[{tid_part}]'
|
||||||
|
|
||||||
|
|
||||||
|
def pformat_thread_uid() -> str:
|
||||||
|
curr_thr: threading.Thread = threading.current_thread()
|
||||||
|
return (
|
||||||
|
f'{curr_thr.name}@{curr_thr.ident}'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
_curr_actor_no_exc = partial(
|
_curr_actor_no_exc = partial(
|
||||||
current_actor,
|
current_actor,
|
||||||
err_on_no_runtime=False,
|
err_on_no_runtime=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_conc_name_getters = {
|
_conc_name_getters = {
|
||||||
'task': pformat_task_uid,
|
# 'task': pformat_task_uid,
|
||||||
|
'task_uid': pformat_task_uid,
|
||||||
'actor': lambda: _curr_actor_no_exc(),
|
'actor': lambda: _curr_actor_no_exc(),
|
||||||
'actor_name': lambda: current_actor().name,
|
'actor_name': lambda: current_actor().name,
|
||||||
'actor_uid': lambda: current_actor().uid[1][:6],
|
'actor_uid': lambda: current_actor().uid[1][:6],
|
||||||
|
'thread_uid': pformat_thread_uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -303,10 +314,11 @@ class ActorContextInfo(Mapping):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
_context_keys = (
|
_context_keys = (
|
||||||
'task',
|
'task_uid',
|
||||||
'actor',
|
'actor',
|
||||||
'actor_name',
|
'actor_name',
|
||||||
'actor_uid',
|
'actor_uid',
|
||||||
|
'thread_uid',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue