# Logging

Canonical page: https://www.adaptabletools.com/docs/dev-guide-support-logging

- Logging can be used by Support Teams to debug AdapTable
- Four message channels (`error`, `warn`, `success`, `info`) plus a `perf` channel are opt-in via `localStorage.debug`
- Critical errors still go to the console without a flag
- On a ticket with a coding agent, the [adaptable-debug](https://www.adaptabletools.com/docs/getting-started-ai-skills-debug/index.md) Skill also reads [DevTools](https://www.adaptabletools.com/docs/dev-guide-support-devtools-api/index.md) logs — see [Supporting AdapTable](https://www.adaptabletools.com/docs/dev-guide-support-overview/index.md)

AdapTable writes console messages as the application runs.

Four **message** channels can be turned on as needed:

- `error`
- `warn`
- `success`
- `info`

A fifth channel, `perf`, logs performance metrics for timed operations (see [Profiling](https://www.adaptabletools.com/docs/dev-guide-support-profiling/index.md)).

These channels are silent until you set `localStorage.debug` as shown below

AdapTable always logs **critical** messages which need to be seen — these require no developer action to be visible

## Making Messages Visible

To make logging visible you need to add a new local storage key-value pair.

This [guide by Chrome](https://developer.chrome.com/docs/devtools/storage/localstorage/#create) provides instructions on how to create local storage key-value pairs

To log **all** messages you need to do:

```
// hint: this may be a bit too noisy!
localStorage.debug = '*'
```

or alternatively, to log all message types for all AdapTable instances:

```
localStorage.debug = 'Adaptable:*'
```

## Setting Message Types

If you want a more granular approach, you can filter by message type or by AdapTable instance (or both) using the following pattern:

```
Adaptable:<adaptableId>:<message_type>
```

 - `<adaptableId>` is the id of the AdapTable instance you want to log for (which was [set during initialisation](https://www.adaptabletools.com/docs/getting-started-adaptable-id/index.md))
 - `<message_type>` is the type of message you want to log, can be one of:
   - `error`: error messages
   - `warn`: warning messages
   - `success`: success messages
   - `info`: info messages
   - `perf`: performance metrics

Examples:

```
// log all messages for a specific AdapTable instance
localStorage.debug = 'Adaptable:<adaptableId>:*'
```

```
// log only error messages for all AdapTable instances
localStorage.debug = 'Adaptable:*:error'
```

```
// log only warn messages for a specific AdapTable instance
localStorage.debug = 'Adaptable:<adaptableId>:warn'
```

Message types are **not** additive; to see multiple message types, specify them all and separate by using a comma

```
// log error and warn messages for a specific AdapTable instance
localStorage.debug = 'Adaptable:<adaptableId>:error,Adaptable:<adaptableId>:warn'
```

```
// log error and perf messages for all AdapTable instances
localStorage.debug = 'Adaptable:*:error,Adaptable:*:perf'
```

## Layout Logging

AdapTable offers additional logging assistance for [Layouts](https://www.adaptabletools.com/docs/handbook-layouts/index.md) as they are so intrinsic to how the tool works.

This can be enabled by setting:

```
localStorage.debug = 'LayoutManager:*'
```

This will log all changes related to a Layout: e.g. column visibility, sorting, row grouping, column resizing, pivoting, aggregations, pinning, switching the layout etc.

## Performance Logging

Logging can be used to log performance metrics for certain operations.

See the [Guide to Profiling](https://www.adaptabletools.com/docs/dev-guide-support-profiling/index.md) for detailed information

## DevTools Grid Info logs

The [AdapTable DevTools](https://www.adaptabletools.com/docs/dev-guide-support-devtools/index.md) **Grid Info → Logs** tab shows **AdapTable** and **Layout Manager** messages already collected for the selected `adaptableId` — filter, sort, and clear without opening the console.

Handbook — [DevTools — Grid Info](https://www.adaptabletools.com/docs/dev-guide-support-devtools-grid-info/index.md#logs). Same data in scripts — [DevTools In-page API](https://www.adaptabletools.com/docs/dev-guide-support-devtools-api/index.md) `getLogs()`.
