relog-rsbuild-plugin
v0.0.2
Published
> 🪵 Capture console logs from your LynxJS app and view them directly in your terminal — designed for use with the **LynxJS Native App Framework** and `rsbuild`.
Readme
relog-rsbuild-plugin
🪵 Capture console logs from your LynxJS app and view them directly in your terminal — designed for use with the LynxJS Native App Framework and
rsbuild.
This plugin allows you to intercept console.log() and console.info() calls from your LynxJS app running on a device or emulator and send them back to the rsbuild dev server where they're printed in your terminal. It's especially useful for debugging native apps where logs might not show up in your local console.
⚠️ Disclaimer: This README and plugin were generated with the help of AI and may contain errors or outdated assumptions.
💡 I'm not affiliated with LynxJS or its maintainers — this project was built independently for use within the LynxJS ecosystem.🙏 Pull requests are welcome! If something doesn’t work or could be improved, feel free to open a PR.
🔗 Related Plugin
This plugin is designed to work alongside ngrok-rsbuild-plugin. It uses the ngrok tunnel URL to forward logs from remote devices when testing on real hardware.
Make sure you’re using both together for the best experience.
✨ Features
- 🔌 Adds a
POST /console_logroute to the dev server for capturing logs - 📄 Automatically generates a
console.jsfile that overridesconsole.logandconsole.info - 🌐 Uses
ngrok(if available) to allow logs from remote devices - ⚙️ Filters out noisy logs (like
[rspeedy-dev-server]and[HMR]) by default - 🧪 Optional
rspeedyLogsflag to include all logs if needed
🛠 Installation
npm install relog-rsbuild-plugin --save-dev🔧 Setup
// rsbuild.config.ts or index.ts
import { pluginRelog } from 'relog-rsbuild-plugin';
export default {
plugins: [
pluginRelog({
rspeedyLogs: false, // set to true if you want to see all logs including [rspeedy] and [HMR]
}),
],
};📁 Output
This plugin will generate a file called console.js in the same directory as the plugin.
You should load this file into your app's entry point (or however your framework handles native-side injection of JavaScript code).
import './path-to-plugin/console.js';This script overrides
console.logandconsole.infoglobally to forward logs to the dev server.
🧩 How it Works
- If
ngrok-rsbuild-pluginis installed and exposes a tunnel URL, that URL is used for logging. - A
console.jsfile is generated pointing tohttp(s)://<host>/console_log. - The script redefines
console.logandconsole.infoto send logs as JSON to the dev server. - The server receives and prints them in your terminal.
🔍 Notes
- Logs are filtered by default to hide common development spam (
[rspeedy-dev-server],[HMR]) — you can turn them back on withrspeedyLogs: true. - The server route is mounted at
/console_log. - Make sure your app loads the generated
console.jsfile.
🧪 Example Output
[APP]: App launched on device
[APP]: Fetching data from API...
[APP]: { status: "ok", data: [...] }License
MIT
