treble_tsdk.scene.scene_generation_log

Classes

SceneGenerationLog

Collects SceneGenerationLogEntry items produced while generating a scene.

SceneGenerationLogEntry

A single entry in a SceneGenerationLog.

class treble_tsdk.scene.scene_generation_log.SceneGenerationLog

Collects SceneGenerationLogEntry items produced while generating a scene.

Supports an “active case” mechanism for tagging entries with the simulation/receiver they relate to without passing that context on every call: set_active_case() stores a simulation_id/receiver_id context that add_entry() (and thus add_warning()) automatically merges into each new entry’s context, filling only keys not already provided explicitly. Call clear_active_case() to stop tagging entries once the active case no longer applies.

Parameters:

entries – Log entries collected so far. Defaults to an empty list.

__init__(entries: list[~treble_tsdk.scene.scene_generation_log.SceneGenerationLogEntry] = <factory>) → None
add_entry(level: str, source: str, message: str, context: dict[str, Any] | None = None) → None

Append a new log entry.

Any active case context set via set_active_case() is merged into context, for keys not already present.

Parameters:
  • level – Severity of the entry (e.g. "warning").

  • source – Name identifying the component/step producing the entry.

  • message – Human-readable log message.

  • context – Extra metadata for the entry. Defaults to an empty dict.

add_warning(source: str, message: str, context: dict[str, Any] | None = None) → None

Append a warning-level log entry.

Equivalent to add_entry() with level="warning", including its active-case context merging.

Parameters:
  • source – Name identifying the component/step producing the entry.

  • message – Human-readable log message.

  • context – Extra metadata for the entry. Defaults to an empty dict.

clear_active_case() → None

Clear the active case context set by set_active_case().

print() → None

Print a user-friendly view of scene generation log entries.

set_active_case(simulation_id: str | None, receiver_id: str | None) → None

Set the simulation/receiver context automatically merged into subsequent entries.

Parameters:
  • simulation_id – Simulation ID to tag new entries with.

  • receiver_id – Receiver ID to tag new entries with.

to_struct() → list[dict[str, Any]]

Serialize all entries to a list of plain dicts.

Returns:

List of dicts as produced by SceneGenerationLogEntry.to_struct().

entries: list[SceneGenerationLogEntry]
property warnings: list[SceneGenerationLogEntry]

All entries with level == "warning".

Type:

return

class treble_tsdk.scene.scene_generation_log.SceneGenerationLogEntry

A single entry in a SceneGenerationLog.

Parameters:
  • level – Severity of the entry (e.g. "warning").

  • source – Name identifying the component/step that produced the entry.

  • message – Human-readable log message.

  • context – Arbitrary extra metadata associated with the entry (e.g. simulation_id/receiver_id when set via SceneGenerationLog.set_active_case()). Defaults to an empty dict.

__init__(level: str, source: str, message: str, context: dict[str, ~typing.Any] = <factory>) → None
to_struct() → dict[str, Any]

Serialize the entry to a plain dict.

Returns:

Dict with level, source, message, and context keys.

context: dict[str, Any]
level: str
message: str
source: str