changeset 3997:1b7c6ee080b9

core (log): type hints
author Goffi <goffi@goffi.org>
date Sat, 04 Mar 2023 18:23:33 +0100
parents 7a6c7abd7dbb
children 402d31527af4
files sat/core/log.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/log.py	Thu Mar 02 12:39:16 2023 +0100
+++ b/sat/core/log.py	Sat Mar 04 18:23:33 2023 +0100
@@ -21,7 +21,7 @@
 # XXX: this module use standard logging module when possible, but as SàT can work in different cases where logging is not the best choice (twisted, pyjamas, etc), it is necessary to have a dedicated module. Additional feature like environment variables and colors are also managed.
 # TODO: change formatting from "%s" style to "{}" when moved to Python 3
 
-from typing import TYPE_CHECKING, Any, Optional
+from typing import TYPE_CHECKING, Any, Optional, Dict
 
 if TYPE_CHECKING:
     from logging import _ExcInfoType
@@ -34,7 +34,7 @@
 import traceback
 
 backend = None
-_loggers = {}
+_loggers: Dict[str, "Logger"] = {}
 handlers = {}
 COLOR_START = '%(color_start)s'
 COLOR_END = '%(color_end)s'
@@ -401,7 +401,7 @@
         raise ValueError('memory output is not used')
     return configure_cls[backend].memoryGet(size)
 
-def getLogger(name=C.LOG_BASE_LOGGER):
+def getLogger(name=C.LOG_BASE_LOGGER) -> Logger:
     try:
         logger_class = configure_cls[backend].LOGGER_CLASS
     except KeyError: