nuxt-frogger
v0.1.19
Published
Logging and tracing module for Nuxt applications
Downloads
1,520
Maintainers
Readme
🐸 Frogger
The zero-setup logger for Nuxt
Log and trace from anywhere in your Nuxt applications. Server to client, client to server, to external services and back again. Install Frogger - add it as a module, and it just works. Automatically batches and sends logs to the server. No matter where you make a log, you'll find it in the same place.
A bare install logs to the console only. Add persistent destinations declaratively with the transport factories — rotated JSON-lines files with fileTransport(), any HTTP ingest with httpTransport(), or a nuxt-observe deployment with observeTransport():
// frogger.config.ts
import { defineFroggerOptions, fileTransport, observeTransport } from '#frogger/config';
export default defineFroggerOptions({
transports: [
fileTransport(), // logs/ on disk
observeTransport({ url: 'https://observe.app.com', key }) // forward to observe
],
});Metrics (opt-in)
Frogger can also collect metrics — a fully separate pipeline from logging,
off by default. Turn it on with metrics: true to auto-collect Web Vitals
(LCP/CLS/INP/FCP/TTFB) and a per-batch device/network envelope:
// frogger.config.ts
import { defineFroggerOptions } from '#frogger/config';
export default defineFroggerOptions({
metrics: true,
});Metrics are stored raw and aggregated on read, carry an optional trace exemplar linking each measurement to the page's trace, and never touch the logging pipeline. See the Metrics guide for the config reference and cardinality model.
Installation
Automatic Installation
To install and register the latest version of Frogger, navigate to your Nuxt project and run the following command:
pnpm:
pnpm dlx nuxi@latest module add nuxt-froggernpm:
npx nuxi@latest module add nuxt-froggerManual Installation
Does the command above not work? You can install Frogger and register it manually:
pnpm:
pnpm add nuxt-froggernpm:
npm install nuxt-froggerRegister the Module
Add 'nuxt-frogger' to modules in your nuxt.config.ts file:
export default defineNuxtConfig({
modules: [
'nuxt-frogger'
]
})Migrating to 0.2.x (breaking)
- File logging is no longer on by default. A bare install logs to the console only. Add
fileTransport()totransportsto restore the previous rotated-file behaviour. - The top-level
filemodule option was removed. Move its settings intofileTransport({ ... }). The resolver warns if a legacyfilekey is still present. public.endpointnow acceptsfalseto disable the browser POST to your app's own ingest route (the server route stays registered) — useful when the client fans out directly to an external sink.- Plain
{ url, apiKey }transport objects still work (an untagged entry is treated ashttpTransport(...)), so existing declarative transports need no changes. HttpTransportretry semantics were fixed. Send failures used to be silently swallowed; they now retry (429/5xx/network) with exponential backoff and drop deterministically on a 4xx. If you depended on the old silent-drop behaviour, note that failing destinations will now be retried.
