소스 검색

get logger only once to save performance

Falko Schindler 2 년 전
부모
커밋
5b4d89768f
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      nicegui/background_tasks.py

+ 2 - 1
nicegui/background_tasks.py

@@ -10,6 +10,8 @@ from . import globals
 
 T = TypeVar('T')
 
+logger = logging.getLogger(__name__)
+
 running_tasks = set()
 
 
@@ -27,7 +29,6 @@ def create(
     Also a reference to the task is kept until it is done, so that the task is not garbage collected mid-execution.
     See https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task.
     '''
-    logger = logging.getLogger(__name__)
     message = 'Task raised an exception'
     message_args = ()
     if loop is None: