# TextRenderer

Class · implements [`Renderer`](https://api.playcanvas.com/splat-transform/interfaces/Renderer.md)

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/utils/text-renderer.ts#L80

Default human-readable text renderer. Emits one event per line - no
carriage-return rewriting, no TTY detection, no buffering. Bars render
as `[#### ...... ] duration`, with `#` appended incrementally on each
`barTick` and the remainder padded with `.` on `barEnd`. `output`
events are treated as line-oriented: their text is written to the
pipeable sink with a trailing `\n` appended (callers should not include
one themselves).

Verbosity is consulted directly from the shared [logger](https://api.playcanvas.com/splat-transform/variables/logger.md) on each
event, so this renderer alone decides what to display - the core
delivers every scope/bar lifecycle event so embedders consuming the
event stream see a faithful record. The display rules are:

- `quiet` - suppresses every scope/bar lifecycle line (start, tick,
  end - including failed ends). Errors, warnings and `output` still
  show.
- `normal` (default) - shows scope/bar headers and bar progress;
  shows failed `scopeEnd` / `barEnd` footers (the "failed in ..."
  cascade from `logger.error` / `unwindAll(true)`); hides successful
  `scopeEnd` footers.
- `verbose` - shows everything, including successful `scopeEnd`
  footers ("done in ...").

Sinks are injected (no `process` reference here) so the renderer works in
both Node CLI and browser/bundle contexts: the CLI passes
`process.stderr.write` for status and `process.stdout.write` for raw
output; library/browser consumers can pass a `console.log` line buffer.

## Properties

### mem

```ts
mem: boolean
```

When true, scope-end and bar-end lines gain a `[peak cpu=X]` suffix
(extended to `[peak cpu=X gpu=Y]` when
[TextRendererOptions.getPeakGpuMemory](https://api.playcanvas.com/splat-transform/interfaces/TextRendererOptions.md#getpeakgpumemory) is also supplied) sourced
from [TextRendererOptions.getPeakCpuMemory](https://api.playcanvas.com/splat-transform/interfaces/TextRendererOptions.md#getpeakcpumemory). No effect when the
probe is omitted. Defaults to `true` when `getPeakCpuMemory` is
provided so embedders that supply a probe see the overlay
automatically. Mutable so the host can toggle the overlay without
re-installing the renderer.

## Methods

### handle

```ts
handle(event: LogEvent): void
```

Handle a log event.

**Parameters**

- `event` ([`LogEvent`](https://api.playcanvas.com/splat-transform/types/LogEvent.md)): The event to render.
