Overview
The console overlay provides a built-in logging and debugging interface that can be toggled on/off during runtime. It capturesconsole.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.Console position on screen
Console size as percentage of screen (10-100)
Z-index for rendering order
Color for INFO level logs
Color for WARN level logs
Color for ERROR level logs
Color for DEBUG level logs
Color for default/LOG level logs
Console background color (supports transparency)
Start with debug mode enabled (shows caller info)
Console title bar text
Title bar background color
Title bar text color
Cursor color (when focused)
Maximum number of log entries to keep
Maximum number of display lines (wrapped)
Callback when text is copied
Custom key bindings
Custom key aliases
Text selection highlight color
Copy button text color
Creating a Configured Console
TerminalConsole Class
Properties
Whether the console is currently visible
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).New terminal width
New terminal height
setDebugMode()
Enable or disable debug mode (shows file/line caller info).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.Formatted log entries
renderToBuffer()
Render the console to a buffer (called automatically).Target buffer to render to
handleMouse()
Handle mouse events (called automatically).Mouse event to handle
Whether the event was handled
Setters
keyBindings
Set custom key bindings.Array of key binding configurations
keyAliasMap
Set custom key aliases.Map of key aliases
onCopySelection
Set the copy selection callback.Callback function
Default Key Bindings
Scroll up one line
Scroll down one line
Scroll to top
Scroll to bottom
Move console to previous position (top → right → bottom → left)
Move console to next position (top → left → bottom → right)
Increase console size by 5%
Decrease console size by 5%
Save logs to file (console[timestamp].log)
Copy selected text
Blur console (unfocus)
ConsoleKeyBinding
Type for console key binding configuration.Key name (e.g., ‘up’, ‘down’, ‘c’, ‘s’)
Ctrl modifier
Shift modifier
Meta/Alt modifier
Super/Cmd modifier
Action to perform
ConsoleAction
Available console actions.scroll-up- Scroll up one linescroll-down- Scroll down one linescroll-to-top- Scroll to the topscroll-to-bottom- Scroll to the bottomposition-previous- Move to previous positionposition-next- Move to next positionsize-increase- Increase size by 5%size-decrease- Decrease size by 5%save-logs- Save logs to filecopy-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
onCopySelectionis 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)