treble_tsdk.scene.scene_generation_log
Classes
Collects |
|
A single entry in a |
- class treble_tsdk.scene.scene_generation_log.SceneGenerationLog
Collects
SceneGenerationLogEntryitems 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 asimulation_id/receiver_idcontext thatadd_entry()(and thusadd_warning()) automatically merges into each new entry’scontext, filling only keys not already provided explicitly. Callclear_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 intocontext, 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()withlevel="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_idwhen set viaSceneGenerationLog.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, andcontextkeys.
- level: str
- message: str
- source: str