> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/custom-script-messages-for-logs.md).

# Custom script messages for logs

## Introduction

When testing and debugging scripts, it can be useful to write specific information to logs after the script has finished processing.

You can do this by adding a `logs` array key to a script, with required output added as strings - for example:

{% code title="PHP" overflow="wrap" lineNumbers="true" %}

```php
function handle($data)
{
    $data['logs'] = ["Log message 1", "Log message 2"];
    return $data;
}
```

{% endcode %}

...is output as:

<figure><img src="/files/89bGb877HDRzh3ciVhAi" alt=""><figcaption></figcaption></figure>

## Need to know

* Log messages must be strings.
* A maximum of 500 characters (in total) is allowed.
* Use with care (especially in loops) as logs are output every time the script runs.
