> For the complete documentation index, see [llms.txt](https://docs.sacruda.nl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sacruda.nl/developers/your-apps-code/verbose-logging.md).

# Verbose logging

If you've ever opened the *Logging* app or peaked at the Developer Console, you'll know that Sacruda has a whole lot of logs, hundreds of them in fact. I did this to make walking through problems in Sacruda as easy as possible. Everything from opening files, checking for updates, spawning apps, even setting environment variables are logged so that I can walk through the logs in effort of finding a bug, without having to resort to tedious debugging using Chrome's developer tools.&#x20;

Luckily, the sophisticated logging system I've implemented is also available to you. Every process you spawn has a `Log` method that you can call. This log method takes a `message` and a level:

```typescript
protected Log(message: string, level?: LogLevel): void;
```

The `LogLevel`  type is actually an enum that represents the different kinds of log levels. Here it is:

```typescript
export enum LogLevel {
    info = 0,
    warning = 1,
    error = 2,
    critical = 3
}
```

Because Javascript doesn't (natively) support enums, I've created a `const` equivalent as part of the TPA props so that you too can just enter `LogLevel.error`, just like me in TypeScript land.

{% hint style="danger" %}
The `LogLevel` TPA property is only available in Sacruda 7.0.4 and above. For older versions, just use the numbers that represent each level (for example, use `2` to log an error).
{% endhint %}

Use the Log method like so:

{% code lineNumbers="true" %}

```typescript
async myAmazingMethod() {
    this.Log("My amazing method was just run", LogLevel.warning);
}
```

{% endcode %}

### What you shouldn't do:

Use `console`. The native Javascript console is only to be used by me when developing Sacruda. If you want to log something, and you need your log to stand out from the rest, just filter the developer console to the PID of your app, and find the debugging info you're looking for. Direct calls to `console` are not liked around here.
