# Tracing

Class · category: Debug

Source: https://github.com/playcanvas/engine/blob/b5b983982a9860d21e0c1dafb2f85f72e2c01afb/src/core/tracing.js#L12

Log tracing functionality, allowing for tracing of the internal functionality of the engine.
Note that the trace logging only takes place in the debug build of the engine and is stripped
out in other builds.

The debug build ships in the npm package: import from `'playcanvas/debug'` instead of
`'playcanvas'` to enable trace channels, assertions and validation warnings. A
`'playcanvas/profiler'` build is also available for per-frame timings.

## Properties

### stack

```ts
static stack: boolean = false
```

Enable call stack logging for trace calls. Defaults to false.

## Methods

### get

```ts
static get(channel: string): boolean
```

Test if the trace channel is enabled.

**Parameters**

- `channel` (`string`): Name of the trace channel.

**Returns** `boolean`: - True if the trace channel is enabled.

### set

```ts
static set(channel: string, enabled?: boolean): void
```

Enable or disable a trace channel.

**Parameters**

- `channel` (`string`): Name of the trace channel. Can be:

  - [TRACEID_RENDER_FRAME](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_FRAME.md)
  - [TRACEID_RENDER_FRAME_TIME](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_FRAME_TIME.md)
  - [TRACEID_RENDER_PASS](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_PASS.md)
  - [TRACEID_RENDER_PASS_DETAIL](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_PASS_DETAIL.md)
  - [TRACEID_RENDER_ACTION](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_ACTION.md)
  - [TRACEID_RENDER_TARGET_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_RENDER_TARGET_ALLOC.md)
  - [TRACEID_TEXTURE_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_TEXTURE_ALLOC.md)
  - [TRACEID_SHADER_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_SHADER_ALLOC.md)
  - [TRACEID_SHADER_COMPILE](https://api.playcanvas.com/engine/variables/TRACEID_SHADER_COMPILE.md)
  - [TRACEID_VRAM_TEXTURE](https://api.playcanvas.com/engine/variables/TRACEID_VRAM_TEXTURE.md)
  - [TRACEID_VRAM_VB](https://api.playcanvas.com/engine/variables/TRACEID_VRAM_VB.md)
  - [TRACEID_VRAM_IB](https://api.playcanvas.com/engine/variables/TRACEID_VRAM_IB.md)
  - [TRACEID_RENDERPIPELINE_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_RENDERPIPELINE_ALLOC.md)
  - [TRACEID_COMPUTEPIPELINE_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_COMPUTEPIPELINE_ALLOC.md)
  - [TRACEID_PIPELINELAYOUT_ALLOC](https://api.playcanvas.com/engine/variables/TRACEID_PIPELINELAYOUT_ALLOC.md)
  - [TRACEID_TEXTURES](https://api.playcanvas.com/engine/variables/TRACEID_TEXTURES.md)
  - [TRACEID_BUFFERS](https://api.playcanvas.com/engine/variables/TRACEID_BUFFERS.md)
  - [TRACEID_ASSETS](https://api.playcanvas.com/engine/variables/TRACEID_ASSETS.md)
  - [TRACEID_GPU_TIMINGS](https://api.playcanvas.com/engine/variables/TRACEID_GPU_TIMINGS.md)
- `enabled` (`boolean`, optional, default `true`): New enabled state for the channel.
