> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/skrypty-scriptservice/api-skryptow/podstawy-pracy-ze-skryptami/logowanie-informacji-i-bledow.md).

# Logging information and errors

{% hint style="info" %}
**More information:** [**Logging in ScriptCode**](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/logowanie-w-scriptcode.md)
{% endhint %}

The logging and exception-throwing mechanisms in ScriptCode allow monitoring the course of business logic, diagnosing problems, and controlled interruption of the application’s operation in the event of business rule violations.

## Event logging (Object `Logger`)

The Eximee platform automatically logs the input parameters passed to scripts. If it is necessary to manually record additional information, a global object is available `Logger`.

The recommended logging levels in ScriptCode are:

* `Logger.info(message, ...args)` – for logging the standard course of business operations.
* `Logger.warn(message, ...args)` – for logging unusual situations that do not interrupt the script but need to be noted.

{% hint style="danger" %}
In ScriptCode scripts **ERROR-level logging should not be used**. Critical errors should be handled by throwing business exceptions.

Entries **ERROR** indicate serious system operation errors and may cause an alarm situation and notification of the support line in the production environment. Errors requiring logging at this level are handled and logged by the platform mechanisms.
{% endhint %}

### Data masking and the function `nonsensitive()`

For security reasons, values passed to logs are automatically masked. If a variable contains data that is completely safe (e.g. does not contain personal data) and must be explicitly visible in logs (e.g. a technical dictionary identifier, a parameter name), use the function `nonsensitive()`.

```javascript
Logger.info(
    'COMPLETE TASK EXECUTED [arg1={}, arg2={}]',
    nonsensitive('arg1 nonsensitive test'),
    'arg2'
);
```

In this example:

* `arg1` will be logged in plain text,
* `arg2` will be hidden (replaced by a sensitive data marker).

### Example of available logging methods

Messages in the object `Logger` support parameterization using curly braces `{}`.

```javascript
function callService(context) {
    Logger.info('COMPLETE TASK EXECUTED [arg1={}, arg2={}]', 'arg1', 'arg2');
    Logger.debug('COMPLETE TASK EXECUTED [arg1={}, arg2={}]', 'arg1', 'arg2');
    Logger.warn('COMPLETE TASK EXECUTED [arg1={}, arg2={}]', 'arg1', 'arg2');
    Logger.error('COMPLETE TASK EXECUTED [arg1={}, arg2={}]', 'arg1', 'arg2');
    Logger.trace('COMPLETE TASK EXECUTED [arg1={}, arg2={}]', 'arg1', 'arg2');
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/scriptcode/skrypty-scriptservice/api-skryptow/podstawy-pracy-ze-skryptami/logowanie-informacji-i-bledow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
