# $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: `error` and `warning` are kept, `success` and `info` are both recorded as `info`. 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

```bdfd
$log[Command run by $username]
Done!
```

### Record with a level

```bdfd
$log[Payment refused for $authorID;error]
```

## Notes

- There is no logarithm function: `$calculate[]` does not support `log`, `ln` or `log10` either.
- `$logQuota` exists 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.
