{"id":18317889,"url":"https://github.com/idiocc/debug","last_synced_at":"2025-07-26T11:10:07.930Z","repository":{"id":57117467,"uuid":"182136076","full_name":"idiocc/debug","owner":"idiocc","description":"The Fork Of Debug For Node That Uses Modern JS.","archived":false,"fork":false,"pushed_at":"2019-07-17T15:31:44.000Z","size":117,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-14T16:47:54.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://idio.cc","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idiocc.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}},"created_at":"2019-04-18T18:12:58.000Z","updated_at":"2019-07-17T15:31:46.000Z","dependencies_parsed_at":"2022-08-23T04:40:42.972Z","dependency_job_id":null,"html_url":"https://github.com/idiocc/debug","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/idiocc/debug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fdebug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fdebug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fdebug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fdebug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idiocc","download_url":"https://codeload.github.com/idiocc/debug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fdebug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267155968,"owners_count":24044402,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-05T18:07:47.623Z","updated_at":"2025-07-26T11:10:07.739Z","avatar_url":"https://github.com/idiocc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @idio/debug\n\n[![npm version](https://badge.fury.io/js/%40idio%2Fdebug.svg)](https://npmjs.org/package/@idio/debug)\n\n`@idio/debug` is the fork of the popular [`debug`](https://github.com/visionmedia/debug/) package that was rewritten in modern JS using the ES6 modules, to be able to compile it with _Closure Compiler_. Currently, only the _Node.JS_ version is supported.\n\n```sh\nyarn add @idio/debug\n```\n\n## Table Of Contents\n\n- [Table Of Contents](#table-of-contents)\n- [API](#api)\n- [`debug(namespace: string): debugFunction`](#debugnamespace-string-debugfunction)\n  * [`_debug.Env`](#type-_debugenv)\n  * [`_debug.DebugContext`](#type-_debugdebugcontext)\n  * [`_debug.DebugFunction`](#type-_debugdebugfunction)\n- [Modifiers](#modifiers)\n- [Copyright](#copyright)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\u003cimg src=\"/.documentary/section-breaks/0.svg?sanitize=true\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## API\n\nThe package is available by importing its default function:\n\n```js\nimport debug from '@idio/debug'\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\u003cimg src=\"/.documentary/section-breaks/1.svg?sanitize=true\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## `debug(`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`namespace: string,`\u003cbr/\u003e`): debugFunction`\n\nCreates a debug function for the given namespace.\n\n```js\nimport debug from '@idio/debug'\n\nconst log = debug('example')\nlog('hello')\nlog('world')\n```\n```\nexample hello +0ms\n  example world +4ms\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eShow Types\u003c/summary\u003e\n\n__\u003ca name=\"type-_debugenv\"\u003e`_debug.Env`\u003c/a\u003e__: An environment.\n\n|       Name       |                                                              Type                                                               |                                                                     Description                                                                      |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |\n| __init*__        | \u003cem\u003efunction(\u003ca href=\"#type-_debugdebugfunction\" title=\"The setup debug function.\"\u003e_debug.DebugFunction\u003c/a\u003e)\u003c/em\u003e               | Env-specific initialization logic for `debug` instances.                                                                                             |\n| __log*__         | \u003cem\u003efunction(...*)\u003c/em\u003e                                                                                                         | The logging function.                                                                                                                                |\n| __formatArgs*__  | \u003cem\u003efunction(this: \u003ca href=\"#type-_debugdebugfunction\" title=\"The setup debug function.\"\u003e_debug.DebugFunction\u003c/a\u003e, !Array)\u003c/em\u003e | Apply env-specific formatting (colors, etc.).                                                                                                        |\n| __save*__        | \u003cem\u003e!Function\u003c/em\u003e                                                                                                              | Save `namespaces`.                                                                                                                                   |\n| __load*__        | \u003cem\u003e!Function\u003c/em\u003e                                                                                                              | Load `namespaces`.                                                                                                                                   |\n| __formatters*__  | \u003cem\u003eObject\u0026lt;string, function(!Object): string\u0026gt;\u003c/em\u003e                                                                        | Map of special \"%n\" handling functions, for the debug \"format\" argument. Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\". |\n| __useColors*__   | \u003cem\u003e!Function\u003c/em\u003e                                                                                                              | Is stdout a TTY? Colored output is enabled when `true`.                                                                                              |\n| __colors*__      | \u003cem\u003e!Array\u0026lt;number\u0026gt;\u003c/em\u003e                                                                                                   | The array of supported colors.                                                                                                                       |\n| __inspectOpts*__ | \u003cem\u003e!Object\u0026lt;string, *\u0026gt;\u003c/em\u003e                                                                                               | The options from the env variables, e.g., `DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js`.                                 |\n\n__\u003ca name=\"type-_debugdebugcontext\"\u003e`_debug.DebugContext`\u003c/a\u003e__\n\n|      Name      |                                                                                                                  Type                                                                                                                   |                                  Description                                   |\n| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |\n| __namespace*__ | \u003cem\u003estring\u003c/em\u003e                                                                                                                                                                                                                         | The namespace for which the debug function was setup.                          |\n| __enabled*__   | \u003cem\u003eboolean\u003c/em\u003e                                                                                                                                                                                                                        | Whether the debug function is enabled.                                         |\n| __useColors*__ | \u003cem\u003eboolean\u003c/em\u003e                                                                                                                                                                                                                        | If the environment uses colors.                                                |\n| __diff*__      | \u003cem\u003enumber\u003c/em\u003e                                                                                                                                                                                                                         | The diff between the prev time and current time.                               |\n| __prev*__      | \u003cem\u003enumber\u003c/em\u003e                                                                                                                                                                                                                         | The previous time.                                                             |\n| __curr*__      | \u003cem\u003enumber\u003c/em\u003e                                                                                                                                                                                                                         | The current time.                                                              |\n| log            | \u003cem\u003efunction(...*)\u003c/em\u003e                                                                                                                                                                                                                 | The manually set logging function that overrides the environment log function. |\n| __color*__     | \u003cem\u003e(number \\| string)\u003c/em\u003e                                                                                                                                                                                                             | The color for the namespace.                                                   |\n| __destroy*__   | \u003cem\u003efunction(this: \u003ca href=\"#type-_debugdebugfunction\" title=\"The setup debug function.\"\u003e_debug.DebugFunction\u003c/a\u003e): boolean\u003c/em\u003e                                                                                                        | Removes the debug function from the namespace.                                 |\n| __extend*__    | \u003cem\u003efunction(this: \u003ca href=\"#type-_debugdebugfunction\" title=\"The setup debug function.\"\u003e_debug.DebugFunction\u003c/a\u003e, string, string): \u003ca href=\"#type-_debugdebugfunction\" title=\"The setup debug function.\"\u003e_debug.DebugFunction\u003c/a\u003e\u003c/em\u003e | Using the debug function, creates a new one.                                   |\n\n`function(this:_debug.DebugContext, ...*)` __\u003ca name=\"type-_debugdebugfunction\"\u003e`_debug.DebugFunction`\u003c/a\u003e__: The setup debug function.\n\u003c/details\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\u003cimg src=\"/.documentary/section-breaks/2.svg?sanitize=true\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## Modifiers\n\nThe modifiers can be used to print information in formatted way.\n\n| Modifier |                 Action                 |\n| -------- | -------------------------------------- |\n| %O       | Multiline inspect.                     |\n| %o       | Single line inspect.                   |\n| %f       | File-size format of bytes, e.g., 10MB. |\n| %fy      | File-size in yellow.                   |\n| %fr      | File-size in red.                      |\n| %fb      | File-size in blue.                     |\n| %fg      | File-size in green.                    |\n| %fc      | File-size in cyan                      |\n| %fm      | File-size in magenta.                  |\n\n```js\nimport Debug from '@idio/debug'\n\nconst debug = Debug('example')\ndebug('hello %O', { test: 'ok' })\ndebug('world %f', 105248)\n```\n```\nexample hello { test: 'ok' } +0ms\n  example world 102.78KB +16ms\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\u003cimg src=\"/.documentary/section-breaks/3.svg?sanitize=true\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## Copyright\n\nOriginal Authors:\n\n- TJ Holowaychuk\n- Nathan Rajlich\n- Andrew Rhyne\n\n---\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://artd.eco\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png\" alt=\"Art Deco\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e© \u003ca href=\"https://artd.eco\"\u003eArt Deco\u003c/a\u003e for \u003ca href=\"https://idio.cc\"\u003eIdio\u003c/a\u003e 2019\u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://idio.cc\"\u003e\n        \u003cimg src=\"https://avatars3.githubusercontent.com/u/40834161?s=100\" width=\"100\" alt=\"Idio\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://www.technation.sucks\" title=\"Tech Nation Visa\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif\"\n          alt=\"Tech Nation Visa\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.technation.sucks\"\u003eTech Nation Visa Sucks\u003c/a\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\u003cimg src=\"/.documentary/section-breaks/-1.svg?sanitize=true\"\u003e\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Fdebug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidiocc%2Fdebug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Fdebug/lists"}