Skip to main content

Overview

The console overlay provides a built-in logging and debugging interface that can be toggled on/off during runtime. It captures console.log, console.error, etc., and displays them in an interactive overlay with scrolling, searching, and log saving capabilities.

Accessing the Console

The console is available through the renderer:

ConsoleOptions

Configuration options for the console overlay.
'top' | 'bottom' | 'left' | 'right'
default:"'bottom'"
Console position on screen
number
default:30
Console size as percentage of screen (10-100)
number
default:null
Z-index for rendering order
ColorInput
default:"'#00FFFF'"
Color for INFO level logs
ColorInput
default:"'#FFFF00'"
Color for WARN level logs
ColorInput
default:"'#FF0000'"
Color for ERROR level logs
ColorInput
default:"'#808080'"
Color for DEBUG level logs
ColorInput
default:"'#FFFFFF'"
Color for default/LOG level logs
ColorInput
default:"RGBA.fromValues(0.1, 0.1, 0.1, 0.7)"
Console background color (supports transparency)
boolean
default:false
Start with debug mode enabled (shows caller info)
string
default:"'Console'"
Console title bar text
ColorInput
default:"RGBA.fromValues(0.05, 0.05, 0.05, 0.7)"
Title bar background color
ColorInput
default:"'#FFFFFF'"
Title bar text color
ColorInput
default:"'#00A0FF'"
Cursor color (when focused)
number
default:2000
Maximum number of log entries to keep
number
default:3000
Maximum number of display lines (wrapped)
(text: string) => void
Callback when text is copied
ConsoleKeyBinding[]
Custom key bindings
KeyAliasMap
Custom key aliases
ColorInput
default:"RGBA.fromValues(0.3, 0.5, 0.8, 0.5)"
Text selection highlight color
ColorInput
default:"'#00A0FF'"
Copy button text color

Creating a Configured Console

TerminalConsole Class

Properties

boolean
Whether the console is currently visible
{ x: number; y: number; width: number; height: number }
Console position and size

Methods

show()

Show the console overlay.

hide()

Hide the console overlay.

toggle()

Toggle console visibility (or toggle focus if already visible).

focus()

Give keyboard focus to the console.

blur()

Remove keyboard focus from the console.

clear()

Clear all console logs.

resize()

Resize the console (usually called automatically).
number
New terminal width
number
New terminal height

setDebugMode()

Enable or disable debug mode (shows file/line caller info).
boolean
Whether to enable debug mode

toggleDebugMode()

Toggle debug mode.

activate()

Activate console capture (intercepts console.log, etc.).

deactivate()

Deactivate console capture (restore original console).

destroy()

Destroy the console and clean up.

getCachedLogs()

Get cached logs as a formatted string.
string
Formatted log entries

renderToBuffer()

Render the console to a buffer (called automatically).
OptimizedBuffer
Target buffer to render to

handleMouse()

Handle mouse events (called automatically).
MouseEvent
Mouse event to handle
boolean
Whether the event was handled

Setters

keyBindings

Set custom key bindings.
ConsoleKeyBinding[]
Array of key binding configurations

keyAliasMap

Set custom key aliases.
KeyAliasMap
Map of key aliases

onCopySelection

Set the copy selection callback.
(text: string) => void
Callback function

Default Key Bindings

key
Scroll up one line
key
Scroll down one line
key
Scroll to top
key
Scroll to bottom
key
Move console to previous position (top → right → bottom → left)
key
Move console to next position (top → left → bottom → right)
key
Increase console size by 5%
key
Decrease console size by 5%
key
Save logs to file (console[timestamp].log)
key
Copy selected text
key
Blur console (unfocus)

ConsoleKeyBinding

Type for console key binding configuration.
string
Key name (e.g., ‘up’, ‘down’, ‘c’, ‘s’)
boolean
Ctrl modifier
boolean
Shift modifier
boolean
Meta/Alt modifier
boolean
Super/Cmd modifier
ConsoleAction
Action to perform

ConsoleAction

Available console actions.
  • scroll-up - Scroll up one line
  • scroll-down - Scroll down one line
  • scroll-to-top - Scroll to the top
  • scroll-to-bottom - Scroll to the bottom
  • position-previous - Move to previous position
  • position-next - Move to next position
  • size-increase - Increase size by 5%
  • size-decrease - Decrease size by 5%
  • save-logs - Save logs to file
  • copy-selection - Copy selected text

ConsolePosition

Enum for console position.

Example Usage

Basic Usage

Custom Configuration

Using Console Methods

Mouse Interaction

The console supports mouse interaction:
  • Scroll wheel - Scroll up/down
  • Click and drag - Select text
  • Click copy button - Copy selected text (if onCopySelection is set)
  • Auto-scroll - Automatically scrolls when dragging near edges

Environment Variables

The console respects these environment variables:
  • OTUI_USE_CONSOLE - Enable/disable console capture (default: true)
  • SHOW_CONSOLE - Show console at startup (default: false)