next-plugin-agent-tail
v0.3.5
Published
Next.js plugin for agent-tail — pipes browser console logs to files on disk during development.
Maintainers
Readme
next-plugin-agent-tail
Next.js plugin for agent-tail — captures browser console.log, console.warn, console.error, unhandled errors, and unhandled promise rejections to log files on disk during development.
Tip: Install the umbrella
agent-tailpackage to get the CLI, Vite plugin, and Next.js plugin in one install:npm install -D agent-tail
Install
npm install -D agent-tailSetup
// next.config.ts
import { withAgentTail } from "agent-tail/next"
export default withAgentTail({
// your Next.js config
})// app/layout.tsx
import { AgentTailScript } from "agent-tail/next/script"
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<head>
{process.env.NODE_ENV === "development" && <AgentTailScript />}
</head>
<body>{children}</body>
</html>
)
}// app/api/__browser-logs/route.ts
export { POST } from "agent-tail/next/handler"Then in another terminal:
tail -f tmp/logs/latest/browser.logPair with the CLI
Use both the plugin and the CLI to get browser console logs and server output in one place:
agent-tail run 'fe: npm run dev' 'api: uvicorn main:app'Docs
Full documentation and configuration options at agent-tail.vercel.app
License
MIT
