openrct2-plugin-logviewer
Log viewer plugin for OpenRCT2
OpenRCT2 Log Viewer
An OpenRCT2 plugin that intercepts console output and displays it in a filterable, colour-coded log viewer window.
Features
- Intercepts
console.log,console.info,console.warn, andconsole.errorwithin the plugin - Colour-coded rows per log level (white, blue, yellow, red)
- Timestamped entries (HH:MM:SS)
- Filter by log level using checkboxes
- Clear all logs
- Dump logs to OpenRCT2's console output
- Cross-plugin support via game actions
Cross-Plugin Logging
Each OpenRCT2 plugin runs in its own sandbox, so console overrides only apply within the logviewer plugin itself. Other plugins can send log entries using the logger module.
Using the Logger Module
Copy src/logger.ts into your plugin project. It has no dependencies beyond the OpenRCT2 runtime.
import { logviewer } from "./logger";
// Use directly
logviewer.warn("Something happened");
logviewer.error("Ride broke down", { rideId: 42 });
// Or create a tagged logger for your plugin
const log = logviewer.tagged("my-plugin");
log.info("initialized"); // → "[my-plugin] initialized"
log.error("out of funds"); // → "[my-plugin] out of funds"
Raw Game Action
If you prefer not to use the module, you can call the game action directly:
context.executeAction("logviewer.log", {
level: "warn", // "log" | "info" | "warn" | "error"
message: "Something happened",
});
A companion test plugin (openrct2-plugin-logsender) is included to demonstrate this.
Requirements
Quick Start
npm install
Set OPENRCT2_PLUGIN_PATH in rollup.config.js to your OpenRCT2 plugin directory:
- Windows:
C:/Users//Documents/OpenRCT2/plugin - macOS:
~/Library/Application Support/OpenRCT2/plugin - Linux:
~/.config/OpenRCT2/plugin
Then:
npm run develop # builds to plugin folder with watch mode
npm run build # release build to ./build/
Open OpenRCT2, go to the map menu, and select Log Viewer.
Project Structure
src/
index.ts Plugin registration and entry point
log.ts Log storage, console override, game action handler
ui.ts FlexUI window with listview, filters, and controls
logger.ts Reusable logger module (copy into other plugins)
test-plugin.ts Companion plugin demonstrating the logger module
Releases
Push a version tag to trigger a GitHub Actions release build:
git tag v0.1.0
git push origin v0.1.0
License
MIT