{"id":15297212,"url":"https://github.com/willybrauner/debug","last_synced_at":"2025-04-13T22:32:02.832Z","repository":{"id":46292108,"uuid":"399853565","full_name":"willybrauner/debug","owner":"willybrauner","description":"Tiny debug tool (~500 bytes) for terminal and browser inspired by debug-js/debug API.","archived":false,"fork":false,"pushed_at":"2024-08-25T14:51:10.000Z","size":273,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:52:39.689Z","etag":null,"topics":["browser","debug","javascript","lib","library","log","node-js","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/willybrauner.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2021-08-25T14:42:57.000Z","updated_at":"2024-08-25T14:51:13.000Z","dependencies_parsed_at":"2024-06-19T01:50:45.346Z","dependency_job_id":"1a2d430c-7930-48b0-bcbd-98180cd8cf87","html_url":"https://github.com/willybrauner/debug","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willybrauner%2Fdebug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willybrauner%2Fdebug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willybrauner%2Fdebug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willybrauner%2Fdebug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willybrauner","download_url":"https://codeload.github.com/willybrauner/debug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248570698,"owners_count":21126489,"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":["browser","debug","javascript","lib","library","log","node-js","nodejs"],"created_at":"2024-09-30T19:15:40.681Z","updated_at":"2025-04-13T22:32:02.815Z","avatar_url":"https://github.com/willybrauner.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @wbe/debug\r\n\r\nTiny debug tool (~500 bytes) for terminal and browser inspired by [debug-js/debug](https://github.com/debug-js/debug) API.\r\n\r\n![](https://img.shields.io/npm/v/@wbe/debug/latest.svg)\r\n![](https://github.com/willybrauner/debug/workflows/CI/badge.svg)\r\n![](https://img.shields.io/bundlephobia/minzip/@wbe/debug.svg)\r\n![](https://img.shields.io/npm/dt/@wbe/debug.svg)\r\n![](https://img.shields.io/npm/l/@wbe/debug.svg)\r\n\r\n![](screen.jpg)\r\n\r\n## Motivation\r\n\r\n`@wbe/debug` was built in order to be as light as possible for terminal and browser,\r\nas the same way as the great debug-js/debug tool.\r\n\r\n## Installation\r\n\r\n```shell script\r\n$ npm i @wbe/debug\r\n```\r\n\r\n## debug node\r\n\r\n```shell\r\nDEBUG=* node file.js\r\n```\r\n\r\nfile.js:\r\n\r\n```js\r\nimport debug from \"@wbe/debug\"\r\nconst log = debug(\"namespace\")\r\nlog(\"hello\") // \"namespace hello\"\r\n```\r\n\r\n`process.env.DEBUG` value can be defined as a specific namespace too:\r\n\r\n```shell\r\nDEBUG=namespace-1 node file.js\r\n```\r\n\r\nOnly debug function declaration with `namespace-1` declared as namespace will be printed in the console:\r\n\r\n```js\r\nimport debug from \"@wbe/debug\"\r\nconst log = debug(\"namespace-1\")\r\nlog(\"hello\") // \"namespace-1 hello\"\r\n```\r\n\r\n`process.env.DEBUG` value accept \"one glob parameter level\":\r\n\r\n```shell\r\nDEBUG=config:* node file.js\r\n```\r\n\r\nEvery debug function declaration with namespace `config:{somestring}` will be logged.\r\n\r\n## debug in browser\r\n\r\nIn the same way as nodejs usage, `debug` is browser compatible with the same API. The only difference is\r\nwe need to set the current namespace in localStorage.\r\n\r\nAdd on your browser localStorage:\r\n\r\n```shell\r\nlocalStorage.debug = \"foo\"\r\n```\r\n\r\nUse debug in javascript:\r\n\r\n```js\r\n// es6 import\r\nimport debug from \"@wbe/debug\"\r\nconst log = debug(\"foo\")\r\nlog(\"bar\") // \"foo bar\"\r\n```\r\n\r\n## Examples\r\n\r\nInstall dependencies:\r\n\r\n```shell\r\npnpm i\r\n```\r\n\r\nStart example:\r\n\r\n```shell\r\n# browser example\r\nnpm run dev:example-browser\r\n# node example\r\nnpm run dev:example-dev\r\n```\r\n\r\n## Credits\r\n\r\nWilly Brauner\r\n\r\n## Licence\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillybrauner%2Fdebug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillybrauner%2Fdebug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillybrauner%2Fdebug/lists"}