{"id":18738995,"url":"https://github.com/gaubee/console-pro-trace","last_synced_at":"2025-11-18T11:30:19.697Z","repository":{"id":57206058,"uuid":"132320390","full_name":"Gaubee/console-pro-trace","owner":"Gaubee","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-18T02:40:45.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T18:46:28.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gaubee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-06T08:31:16.000Z","updated_at":"2021-12-18T09:35:07.000Z","dependencies_parsed_at":"2022-09-18T06:47:14.070Z","dependency_job_id":null,"html_url":"https://github.com/Gaubee/console-pro-trace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fconsole-pro-trace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fconsole-pro-trace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fconsole-pro-trace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaubee%2Fconsole-pro-trace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gaubee","download_url":"https://codeload.github.com/Gaubee/console-pro-trace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239616131,"owners_count":19668992,"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":[],"created_at":"2024-11-07T15:32:22.930Z","updated_at":"2025-11-18T11:30:18.607Z","avatar_url":"https://github.com/Gaubee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# console trace\n\ntarce your function. calc the case time.\n\nwhen you have cluster process. you can use [mter](https://www.npmjs.com/package/mter) to split the log view.\n\n## usage\n\n```ts\n// test/demo1.ts\nimport { console, registerClassDebug, IS_IN_TRACE_MODE } from '../src/';\nclass A {\n    async say(word) {\n        console.log(word)\n    }\n}\nregisterClassDebug(A, 'A');\n\nconst a = new A();\na.say('qaq');\n```\n\nThe log is not output by default. You need to configure environment variables:`TRACE` or `CONSOLE_PRO_TRACE`.\n\nfor example:\n```shell\n# in unix\nTRACE='*' node your-app.js\n\n# in windows cmd\nset TRACE=\"*\"\nnode your-app.js\n\n# in windows powershell\n$env:TRACE=\"*\"\nnode your-app.js\n```\n\nnow, run the `demo1.ts`:\n`TRACE=* ts-node test/demo1.ts`\n\n![image](https://user-images.githubusercontent.com/2151644/39671433-ec3e6f3a-514a-11e8-9b34-a6619e85469c.png)\n\n\n\u003e PS:the `console` instance is from [console-pro](https://www.npmjs.com/package/console-pro).\n\n## about the `TRACE`\n\n### example 1\n```ts\nregisterClassDebug(A, 'A');\nregisterClassDebug(B, 'B');\n```\n\n```shell\nTRACE=\"A,B\"\n```\n\n### example 2\n```ts\nregisterClassDebug(A, 'my/A');\nregisterClassDebug(B, 'my/B');\n```\n\n```shell\nTRACE=\"my/*\"\n```\n\n## extends config\n\nyou can define static function `getUnDebugMethodNames` for class to skip debug some function.\n```ts\nclass A {\n    async say(word) {\n        console.log(word)\n    }\n    private _dosomething(cb){\n        setTimeout(cb, 1000)\n    }\n    static getUnDebugMethodNames(){\n        return [\"_dosomething\"]\n    }\n}\n```\n\n## debug an object\n\n```ts\nimport { console, registerInstanceDebug } from '../src/';\nregisterInstanceDebug({\n    async say(word) {\n        console.log(word)\n    }\n    _dosomething(cb){\n        setTimeout(cb, 1000)\n    }\n    getUnDebugMethodNames(){\n        return [\"_dosomething\"]\n    }\n}, 'my/simple/instance');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fconsole-pro-trace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaubee%2Fconsole-pro-trace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaubee%2Fconsole-pro-trace/lists"}