refactor logging usage

This commit is contained in:
2023-02-01 11:17:04 +01:00
parent 3eeb58182b
commit 7b5df331ef
22 changed files with 105 additions and 113 deletions

View File

@ -1,4 +1,5 @@
import enum
import logging
import struct
from eive_tmtc.pus_tm.defs import PrintWrapper
@ -15,7 +16,7 @@ from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
LOGGER = get_console_logger()
_LOGGER = logging.getLogger(__name__)
class ActionId(enum.IntEnum):
@ -244,7 +245,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
while True:
active_sd_card = int(input("Please specify active SD cqrd [0/1]: "))
if active_sd_card not in [0, 1]:
LOGGER.warning("Invalid SD card specified. Try again")
_LOGGER.warning("Invalid SD card specified. Try again")
break
q.add_log_cmd(Info.SWITCH_TO_BOTH_SD_CARDS)
q.add_pus_tc(
@ -282,9 +283,9 @@ def determine_reboot_params() -> (bool, Chip, Copy):
copy_select = -1
reboot_self = input("Reboot self? [y/n]: ")
if reboot_self in ["y", "yes", "1"]:
LOGGER.info("Rebooting currently running image")
_LOGGER.info("Rebooting currently running image")
return True, chip_select, copy_select
LOGGER.info("Rebooting image specified by chip and copy")
_LOGGER.info("Rebooting image specified by chip and copy")
return False, determine_chip_and_copy()
@ -298,7 +299,7 @@ def determine_chip_and_copy() -> (int, int):
chip_select = Chip.CHIP_1
break
else:
LOGGER.warning("Invalid chip select value. Try again")
_LOGGER.warning("Invalid chip select value. Try again")
while True:
copy_select = input("Copy select [0/1]: ")
if copy_select in ["0", "1"]:
@ -308,7 +309,7 @@ def determine_chip_and_copy() -> (int, int):
copy_select = Copy.COPY_1_GOLD
break
else:
LOGGER.warning("Invalid copy select value. Try again")
_LOGGER.warning("Invalid copy select value. Try again")
return chip_select, copy_select