akkudoktoreos.server.rest.starteosdash.patch_loguru_record

akkudoktoreos.server.rest.starteosdash.patch_loguru_record(record: MutableMapping[str, Any], *, file_name: str, file_path: str, line_no: int, function: str, logger_name: str = 'EOSdash') None

Patch a Loguru log record with subprocess-origin metadata.

This helper mutates an existing Loguru record in-place to update selected metadata fields (file, line, function, and logger name) while preserving Loguru’s internal record structure. It must be used with logger.patch() and must not replace structured fields (such as record["file"]) with plain dictionaries.

The function is intended for forwarding log messages originating from subprocess stdout/stderr streams into Loguru while retaining meaningful source information (e.g., file path and line number).

Parameters:
  • record – The Loguru record dictionary provided to logger.patch().

  • file_name – The source file name to assign (e.g. "main.py").

  • file_path – The full source file path to assign (e.g. "/app/server/main.py").

  • line_no – The source line number associated with the log entry.

  • function – The function name associated with the log entry.

  • logger_name – The logical logger name to assign to the record. Defaults to "EOSdash".

Notes

  • This function mutates the record in-place and returns None.

  • Only attributes of existing structured objects are modified; no structured Loguru fields are replaced.

  • Replacing record["file"] or similar structured fields with a dictionary will cause Loguru sinks to fail.