π $log β Structured Logging API β
The $log API provides a simple, structured logging mechanism for plugins.
It automatically enriches logs with:
- plugin context
- timestamps
- consistent formatting
π§ Core Concept β
ts
$log(title, message, level)titleβ short labelmessageβ any data (string, object, etc.)levelβ log level (number)
π§ Basic Usage β
ts
$log("init", "Component mounted", 1)π§© Examples β
Logging a string β
ts
$log("hallo", "dings", 1)Console output:
plugin/<plugin-name> - hallo
{
message: "dings",
dateTime: "21.04.2026 - 17:30:40:615"
}Logging an object β
ts
$log("hallo", { title: "test" }, 1)βοΈ Behavior β
Automatically prefixes:
plugin/<pluginKey> - <title>Adds timestamp (
dateTime)Accepts any message type
π§ Log Levels β
Typical convention (can vary by setup):
0β error1β info2β debug
π§ Mental Model β
$log= structuredconsole.log- consistent format across plugins
- enriched with plugin context
βοΈ When to Use $log β
Use $log for:
- debugging plugin logic
- tracing events
- logging API responses
- development insights
π« Important Notes β
- Not intended for user-facing messages
- Use
$eventbusor UI notifications instead - Avoid excessive logging in production
π§ Key Takeaway β
$log gives you clean, contextual, and consistent debugging output