osrlib.messages
The default English message formatter.
format_message renders any Event
to a plain English line — pure string templating keyed by the event's outcome-bearing
code, no I/O. It is a total function: an event whose code has no template formats to
the code string itself rather than raising, so a transcript stays printable even when
it holds event types this version of the library doesn't recognize.
Templates reference entity IDs, not names — events carry structured facts and IDs only. A front end or narrator that wants prose with names resolves IDs itself and localizes freely; this formatter exists so a bare kernel transcript is readable without one.
format_message
Format an event as a default English message.
Total: an event whose code has no template formats to the code string itself — never raises — so logs carrying event types this function doesn't recognize stay printable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The event to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The formatted English line, or the event's code when no template exists. |
Examples: