{"_id":"patch-console","_rev":"2949038","name":"patch-console","description":"Patch console methods to intercept output","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"vdemedes","email":"sbioko@gmail.com"}],"time":{"modified":"2023-04-26T08:55:34.000Z","created":"2020-06-15T16:44:08.060Z","2.0.0":"2022-02-04T09:24:24.525Z","1.0.0":"2020-06-15T16:44:08.060Z"},"users":{},"author":{"name":"vdemedes","email":"vdemedes@gmail.com","url":"https://github.com/vadimdemedes"},"repository":{"type":"git","url":"git+https://github.com/vadimdemedes/patch-console.git"},"versions":{"2.0.0":{"name":"patch-console","version":"2.0.0","description":"Patch console methods to intercept output","license":"MIT","repository":{"type":"git","url":"git+https://github.com/vadimdemedes/patch-console.git"},"author":{"name":"vdemedes","email":"vdemedes@gmail.com","url":"https://github.com/vadimdemedes"},"type":"module","exports":"./dist/index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"build":"tsc","dev":"tsc --watch","prepare":"npm run build","pretest":"npm run build","test":"prettier --check source && xo && ava"},"keywords":["stdout","stderr","patch","console","intercept","log","logs"],"devDependencies":{"@sindresorhus/tsconfig":"^2.0.0","@types/node":"^17.0.14","@vdemedes/prettier-config":"^2.0.1","ava":"^4.0.1","prettier":"^2.5.1","sinon":"^9.0.2","typescript":"^4.5.5","xo":"^0.47.0"},"prettier":"@vdemedes/prettier-config","xo":{"prettier":true},"ava":{"serial":true},"gitHead":"8ac1241b93948fa0e41e0a9fed33d5366d34559c","bugs":{"url":"https://github.com/vadimdemedes/patch-console/issues"},"homepage":"https://github.com/vadimdemedes/patch-console#readme","_id":"patch-console@2.0.0","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"shasum":"9023f4665840e66f40e9ce774f904a63167433bb","size":2678,"noattachment":false,"key":"/patch-console/-/patch-console-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/patch-console/download/patch-console-2.0.0.tgz"},"_npmUser":{"name":"vdemedes","email":"vadimdemedes@hey.com"},"directories":{},"maintainers":[{"name":"vdemedes","email":"sbioko@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/patch-console_2.0.0_1643966664382_0.9222046884454422"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-04T09:24:29.822Z","publish_time":1643966664525,"_cnpm_publish_time":1643966664525},"1.0.0":{"name":"patch-console","version":"1.0.0","description":"Patch console methods to intercept output","license":"MIT","repository":{"type":"git","url":"git+https://github.com/vadimdemedes/patch-console.git"},"author":{"name":"vdemedes","email":"vdemedes@gmail.com","url":"https://github.com/vadimdemedes"},"main":"build","types":"build/index.d.ts","engines":{"node":">=10"},"scripts":{"prepare":"tsc","test":"prettier --check src && tsc && xo && ava"},"keywords":["stdout","stderr","patch","console","intercept","log","logs"],"devDependencies":{"@sindresorhus/tsconfig":"^0.7.0","@types/node":"^14.0.13","ava":"^3.9.0","prettier":"^2.0.5","sinon":"^9.0.2","typescript":"^3.9.5","xo":"^0.32.0"},"prettier":{"useTabs":true,"singleQuote":true,"quoteProps":"as-needed","trailingComma":"none","bracketSpacing":false,"arrowParens":"avoid"},"xo":{"prettier":true},"ava":{"serial":true},"gitHead":"4c35d6c4d340aff921dafc8ec54bd0a5e4b7f930","bugs":{"url":"https://github.com/vadimdemedes/patch-console/issues"},"homepage":"https://github.com/vadimdemedes/patch-console#readme","_id":"patch-console@1.0.0","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"shasum":"19b9f028713feb8a3c023702a8cc8cb9f7466f9d","size":2029,"noattachment":false,"key":"/patch-console/-/patch-console-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/patch-console/download/patch-console-1.0.0.tgz"},"maintainers":[{"name":"vdemedes","email":"sbioko@gmail.com"}],"_npmUser":{"name":"vdemedes","email":"vdemedes@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/patch-console_1.0.0_1592239447937_0.38488768892717573"},"_hasShrinkwrap":false,"publish_time":1592239448060,"_cnpm_publish_time":1592239448060}},"readme":"# patch-console ![test](https://github.com/vadimdemedes/patch-console/workflows/test/badge.svg)\n\n> Patch console methods to intercept output\n\n## Install\n\n```\n$ npm install patch-console\n```\n\n## Usage\n\n```js\nconst patchConsole = require('patch-console');\n\nconst restore = patchConsole((stream, data) => {\n\t// stream = 'stdout'\n\t// data = \"Hello World\"\n});\n\nconsole.log('Hello World');\n\n// Restore original methods\nrestore();\n```\n\n## API\n\n### patchConsole(callback)\n\nAfter this function is called, output from console methods will be intercepted and won't show up in the actual stdout or stderr stream.\nTo restore original console methods and stop intercepting output, call the function which `patchConsole()` returns.\n\n#### callback\n\nType: `Function`\n\nFunction that will be called when output from one of the console methods is intercepted.\nFirst argument is name of the stream (`\"stdout\"` or `\"stderr\"`), second argument is output itself.\n\n## Console methods\n\nThis module intercepts the following methods:\n\n- `console.assert()`\n- `console.count()`\n- `console.countReset()`\n- `console.debug()`\n- `console.dir()`\n- `console.dirxml()`\n- `console.error()`\n- `console.group()`\n- `console.groupCollapsed()`\n- `console.groupEnd()`\n- `console.info()`\n- `console.log()`\n- `console.table()`\n- `console.time()`\n- `console.timeEnd()`\n- `console.timeLog()`\n- `console.trace()`\n- `console.warn()`\n","_attachments":{},"homepage":"https://github.com/vadimdemedes/patch-console#readme","bugs":{"url":"https://github.com/vadimdemedes/patch-console/issues"},"license":"MIT"}