refactor logging usage
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
import enum
|
||||
import logging
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -40,7 +39,7 @@ def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
|
@ -1,4 +1,5 @@
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
import time
|
||||
from typing import Optional
|
||||
@ -24,11 +25,10 @@ from tmtccmd.tc.pus_20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
pack_boolean_parameter_app_data,
|
||||
)
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -369,10 +369,10 @@ def request_wait_time() -> Optional[float]:
|
||||
try:
|
||||
wait_time = float(wait_time)
|
||||
except ValueError:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
continue
|
||||
if wait_time <= 0:
|
||||
LOGGER.warning("Invalid input")
|
||||
_LOGGER.warning("Invalid input")
|
||||
else:
|
||||
return wait_time
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
@ -74,8 +75,6 @@ from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def handle_default_procedure(
|
||||
tc_base: TcHandlerBase,
|
||||
@ -216,4 +215,4 @@ def handle_default_procedure(
|
||||
queue_helper=queue_helper,
|
||||
),
|
||||
):
|
||||
LOGGER.warning(f"Invalid Service {service}")
|
||||
logging.getLogger(__name__).warning(f"Invalid Service {service}")
|
||||
|
@ -1,14 +1,12 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCode:
|
||||
@ -24,6 +22,6 @@ def pack_set_current_time_ascii_command(p: ServiceProviderParams):
|
||||
q = p.queue_helper
|
||||
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||||
current_time_ascii = time_test_current_time.encode("ascii")
|
||||
LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
|
||||
logging.getLogger(__name__).info(f"Current time in ASCII format: {current_time_ascii}")
|
||||
q.add_log_cmd(Info.SET_CURRENT_TIME)
|
||||
q.add_pus_tc(PusTelecommand(service=9, subservice=128, app_data=current_time_ascii))
|
||||
|
Reference in New Issue
Block a user