core (log): type hints

This commit is contained in:
Goffi 2023-03-04 18:23:33 +01:00
commit ab3f76a559

View file

@ -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 @@ from sat.core import exceptions
import traceback
backend = None
_loggers = {}
_loggers: Dict[str, "Logger"] = {}
handlers = {}
COLOR_START = '%(color_start)s'
COLOR_END = '%(color_end)s'
@ -401,7 +401,7 @@ def memoryGet(size=None):
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: