{"id":15063151,"url":"https://github.com/ms-fadaei/nuxt-browser-console","last_synced_at":"2025-04-10T10:34:02.989Z","repository":{"id":37025263,"uuid":"362224457","full_name":"ms-fadaei/nuxt-browser-console","owner":"ms-fadaei","description":"See server-side reports inside browser console","archived":false,"fork":false,"pushed_at":"2024-04-12T20:32:58.000Z","size":861,"stargazers_count":8,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T04:55:54.080Z","etag":null,"topics":["console-log","logger","nuxt","nuxt-module","nuxtjs","ssr","vue"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ms-fadaei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-04-27T19:13:57.000Z","updated_at":"2024-04-23T05:21:51.037Z","dependencies_parsed_at":"2024-01-31T13:26:23.885Z","dependency_job_id":"e0c64824-0a1b-441e-9461-bc50a8161add","html_url":"https://github.com/ms-fadaei/nuxt-browser-console","commit_stats":{"total_commits":107,"total_committers":3,"mean_commits":"35.666666666666664","dds":"0.30841121495327106","last_synced_commit":"45bd6a4d34363cd1ead184bb4a04df7c1a1f06b2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-fadaei%2Fnuxt-browser-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-fadaei%2Fnuxt-browser-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-fadaei%2Fnuxt-browser-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-fadaei%2Fnuxt-browser-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ms-fadaei","download_url":"https://codeload.github.com/ms-fadaei/nuxt-browser-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199245,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console-log","logger","nuxt","nuxt-module","nuxtjs","ssr","vue"],"created_at":"2024-09-24T23:52:21.908Z","updated_at":"2025-04-10T10:34:02.954Z","avatar_url":"https://github.com/ms-fadaei.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nuxt-browser-console\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![License][license-src]][license-href]\n\n\u003e receive server-side and client-side logs/errors/warnings inside the browser console \u003cbr\u003e\n\n\u003e ⚠️ If you are using nuxt 3, see the [next](https://github.com/ms-fadaei/nuxt-browser-console/tree/next) branch\n\nWith this module, you can use browser console methods. No matter you are using this module inside the server or client, the messages are always shown in the browser console. A good and cheap way to monitoring server events in the production environment (for example, Axios request and response information can be logged into the browser console).\n\n[📖 **Release Notes**](./CHANGELOG.md)\n\n## Setup\n\n1. Add `nuxt-browser-console` dependency with `yarn` or `npm` to your project\n\n```bash\nyarn add nuxt-browser-console # or npm install nuxt-browser-console\n```\n\n2. Add `nuxt-browser-console` to the `modules` section of `nuxt.config.js`\n\n```js\n{\n  modules: [\n    // Simple usage\n    'nuxt-browser-console',\n\n    // With options\n    ['nuxt-browser-console', { /* module options */ }]\n  ],\n  browserConsole: {\n    /* module options */\n  }\n}\n```\n\n## Options\nModule default options:\n\n\n| Option | Default | Description |\n| ------ | ------- | ----------- |\n| namespace | `console` | the namespace of the module. `this.$console.log(...)` or `$console.log(...)` inserted fom nuxt [context](https://nuxtjs.org/docs/2.x/concepts/context-helpers) |\n\n\n```js\n{\n  browserConsole: {\n    namespace: 'console'\n  }\n}\n```\n\n## Usage\nYou can simply use this module through `this` or context `$console` almost every where in your Nuxt app.\n\n```js\n  this.$console.log(...args)\n```\n\nAvailable methods:\n```js\n$console.log(obj1 [, obj2, ..., objN])\n$console.info(obj1 [, obj2, ..., objN])\n$console.warn(obj1 [, obj2, ..., objN])\n$console.error(obj1 [, obj2, ..., objN])\n$console.clear()\n$console.groupCollapsed([label])\n$console.groupEnd()\n```\n\nAn example to show how to use this module to log some data inside the browser (no matter server-side/client-side).\n```js\nexport default function ({$axios, $console}) {\n\n  const style = \"background: #d32f2f;border-radius: 0.5em;color: white;font-weight: bold;padding: 2px 0.5em;\";\n\n  $axios.interceptors.response.use((x) =\u003e {\n    $console.groupCollapsed('', `%cRequest to ${x.config.url.split(\"?\")[0]}`, style);\n\n    $console.info('URL:', `${x.config.baseURL}${x.config.url}`);\n\n    $console.info('Method:', x.config.method.toUpperCase());\n\n    $console.info('Status:', `${x.statusText || 'OK'} (${x.status})`);\n    \n    $console.groupEnd();\n\n    return x;\n  });\n}\n```\n\n## Development\n\n1. Clone this repository\n2. Install dependencies using `yarn install` or `npm install`\n3. Start development server using `yarn dev` or `npm run dev`\n\n## Todo\n\n* [ ] error stack trace correction\n* [x] module separation\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) Mohammad Saleh Fadaei ([@ms-fadaei](https://github.com/ms-fadaei))\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-browser-console/latest.svg\n[npm-version-href]: https://npmjs.com/package/nuxt-browser-console\n\n[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-browser-console.svg\n[npm-downloads-href]: https://npmjs.com/package/nuxt-browser-console\n\n[github-actions-ci-src]: https://github.com/ms-fadaei/nuxt-browser-console/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/ms-fadaei/nuxt-browser-console/actions?query=workflow%3Aci\n\n[codecov-src]: https://img.shields.io/codecov/c/github/ms-fadaei/nuxt-browser-console.svg\n[codecov-href]: https://codecov.io/gh/ms-fadaei/nuxt-browser-console\n\n[license-src]: https://img.shields.io/npm/l/nuxt-browser-console.svg\n[license-href]: https://npmjs.com/package/nuxt-browser-console\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fms-fadaei%2Fnuxt-browser-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fms-fadaei%2Fnuxt-browser-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fms-fadaei%2Fnuxt-browser-console/lists"}