Math & Text
log
$log[]
The function $log[] hands a text message to the host’s execution log. It is a debugging aid: it is not a mathematical function, and it has no relation to logarithms.
Syntax
$log[message;level]
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message |
text | Yes | The text to record. It is evaluated like any other argument. |
level |
text | No | success, info, warning or error (case-insensitive, spaces around are ignored). info by default; an empty level is info. |
Behavior
- Takes one or two arguments; three or more are rejected (“Invalid argument count”).
- Any other level raises the error “Log level must be success, info, warning or error.” and nothing is recorded.
- Always returns an empty string, so it never adds anything to the message.
- It does not send anything to the channel.
- On a hosted bot (managed runner), the line goes to the bot’s log with the “user” audience and keeps its level:
errorandwarningare kept,successandinfoare both recorded asinfo. A bot can record at most 600 lines per minute; the rest of that minute is dropped. - In the app’s command sandbox, the messages are collected in the list of logs and the level is not kept.
- The message is only recorded when the host that runs the script provides a log collector. When no collector is provided (for example a self-hosted runner without the Manager), the call does nothing.
Examples
Record a value while debugging
$log[Command run by $username]
Done!
Record with a level
$log[Payment refused for $authorID;error]
Notes
- There is no logarithm function:
$calculate[]does not supportlog,lnorlog10either. $logQuotaexists only for compatibility with the original BibiScript: it always returns a positive value (1000), so quota checks written for the original BibiScript keep working, and it does not count the lines you record.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.