Logging API
Send a bounded diagnostic message to the live game console.
When to call it
Log lifecycle transitions and recoverable errors. Avoid per-frame logging outside short debugging sessions because bounded queues can drop excessive output.
Calls
rustic.log(level, message, fields?)print(...) — Lua and JavaScript infowarn(...) — Lua and JavaScript warning
Variables
| Variable | Type | Required | Description |
|---|---|---|---|
level | string | Yes | debug, info, warn, or error. |
message | string | Yes | Human-readable diagnostic text. |
fields | table / object | No | Optional structured fields where supported; omit for portability. |
Return and timing
No value. The message is queued for the bounded console sink.
Language examples
Lua 5.4
lua
rustic.log('info', 'player spawned')JavaScript
javascript
rustic.log('info', 'player spawned');Python
python
rustic.log('info', 'player spawned')C++
cpp
rustic.log("info", "player spawned");C#
csharp
rustic.log("info", "player spawned");Luau
lua
rustic.log('info', 'player spawned')C
c
rustic.log("info", "player spawned");Java
java
rustic.log("info", "player spawned");PHP
php
$rustic->log('info', 'player spawned');HTML / inline JS
javascript
rustic.log('info', 'player spawned');Constraints and behavior
- In Lua and JavaScript, print(...) writes an info entry and warn(...) writes a warning entry to the Rustic Console. Lua separates multiple arguments with tabs; JavaScript separates them with spaces. Use rustic.log for an explicit level. External programs must not print diagnostics to stdout; stdout is reserved for protocol responses.
- Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.