Logging Package

Submodules

tmtccmd.logging.pus

class tmtccmd.logging.pus.RawTmtcLogBase(logger: Logger, log_repr: bool = True, log_raw_repr: bool = True)

Bases: object

log_bytes_readable(prefix: str, packet: bytes)
log_bytes_repr(prefix: str, packet: bytes)
log_repr(prefix: str, packet: PusTc | PusTm)
log_tc(packet: PusTc)

Default log function which logs the Python packet representation and raw bytes

log_tm(packet: PusTm)

Default log function which logs the Python packet representation and raw bytes

static tc_prefix(packet: PusTc, counter: int)
static tm_prefix(packet: PusTm, counter: int)
class tmtccmd.logging.pus.RawTmtcRotatingLogWrapper(max_bytes: int, backup_count: int, logger: Logger | None = None, file_name: Path = PosixPath('log/tmtccmd_raw_pus'), suffix: str | None = '2026-01-14.log')

Bases: RawTmtcLogBase

Create a raw TMTC rotating log wrapper. See the official Python documentation at https://docs.python.org/3/library/logging.handlers.html#rotatingfilehandler for more information on the input parameters

Parameters:
  • max_bytes – Maximum number of bytes per file. If backup_count is non-zero, the handler will create a new file up to the number of back_up count files. If the maximum backup count is reached, the oldest files will be deleted

  • backup_count – If this is zero, Only max_bytes can be stored. Otherwise, a rollover will occur when a file reaches max_bytes and up to back_count files can be created this way.

  • file_name – Base filename of the log file

  • suffix – Suffix of the log file. Can be used to change the used log file. The default argument will use a date suffix, which will lead to a new unique rotating log created every day

class tmtccmd.logging.pus.RawTmtcTimedLogWrapper(when: TimedLogWhen, interval: int, logger: Logger | None = None, file_name: Path = PosixPath('log/tmtccmd_raw_pus'), suffix: str | None = '2026-01-14.log')

Bases: RawTmtcLogBase

Create a raw TMTC timed rotating log wrapper. See the official Python documentation at https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler for more information on the input parameters

Parameters:
  • when – A new log file will be created at the product of when and interval

  • interval – A new log file will be created at the product of when and interval. For example, using when=”H” and interval=3, a new log file will be created in three hour intervals

  • file_name – Base filename of the log file

class tmtccmd.logging.pus.RegularTmtcLogWrapper(file_name: Path | None = None, logger: Logger | None = None)

Bases: object

classmethod get_current_tmtc_file_name() Path
class tmtccmd.logging.pus.TimedLogWhen(value)

Bases: Enum

An enumeration.

PER_DAY = 'D'
PER_HOUR = 'h'
PER_MINUTE = 'M'
PER_SECOND = 'S'
tmtccmd.logging.pus.date_suffix() str