# outputDebugString (Shared)

> Writes a line to this side's script log, as an error, a warning or a message.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Output and debugging
- **URL**: https://wiki.mymp.gg/en/outputDebugString

## Syntax

```lua
bool outputDebugString(string text [, int level = 3])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `text` | `string` | The text. |
| `level` | `int` | `1` error, `2` warning; any other value is a plain message. Errors and warnings carry the file and line they came from. *(default: `3`)* |

## Returns

`true` once the line is written.

An error or warning repeated within 5 seconds is written once and then summed up with `[DUP xN]`. The line first goes through `onDebugMessage` (`onClientDebugMessage` on a client), which may cancel it.

## Example

```lua
local ok = setTime(12, 0)
if not ok then
    outputDebugString("Could not set the time", 2)
end
```

## See also

- [print (Shared)](https://wiki.mymp.gg/en/print.md): Writes the values given to the script log as a message, separated by tabs.
- [outputServerLog (Shared)](https://wiki.mymp.gg/en/outputServerLog.md): Writes a message to this side's log, with the resource's name in front.
- [onDebugMessage (Server)](https://wiki.mymp.gg/en/onDebugMessage.md): Fired on the server for every script line that goes to the log: errors, warnings and messages.
