Skip to content

Commit

Permalink
Merge pull request #492 from NASA-AMMOS/issue-491
Browse files Browse the repository at this point in the history
Issue #491 - Add logger type annotations for GUI mypy checks
  • Loading branch information
MJJoyce authored Jan 24, 2023
2 parents b699b04 + 74f9778 commit 1ae8173
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions ait/core/log.py
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
import socket
import datetime
import time
from typing import Callable, Optional

import logging
import logging.handlers
@@ -38,6 +39,13 @@
logging.addLevelName(COMMAND, "COMMAND")
logging.addLevelName(PROGRAM, "PROGRAM")

logger = None
crit: Optional[Callable[[str], str]] = None
debug: Optional[Callable[[str], str]] = None
error: Optional[Callable[[str], str]] = None
info: Optional[Callable[[str], str]] = None
warn: Optional[Callable[[str], str]] = None


class LogFormatter(logging.Formatter):
"""LogFormatter
@@ -312,14 +320,4 @@ def notice(*args, **kwargs):
logger.log(NOTICE, *args, **kwargs)


# These are "guaranteed" at runtime to be not-None. Marking this as
# type `Any` addresses mypy issues where log calls are marked as
# "None" being not callable.
logger = None
crit = None
debug = None
error = None
info = None
warn = None

init()

0 comments on commit 1ae8173

Please sign in to comment.