All Projects → sindresorhus → Filter Console

sindresorhus / Filter Console

Licence: mit
Filter out unwanted `console.log()` output

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Filter Console

Konsul
A react renderer for browser's dev console
Stars: ✭ 605 (+198.03%)
Mutual labels:  console, devtools, browser
Tiza
Console styling for browsers
Stars: ✭ 74 (-63.55%)
Mutual labels:  console, browser
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+445.32%)
Mutual labels:  console, browser
Chalk Animation
🎬 Colorful animations in terminal output
Stars: ✭ 1,489 (+633.5%)
Mutual labels:  console, npm-package
Crypto Hash
Tiny hashing module that uses the native crypto API in Node.js and the browser
Stars: ✭ 501 (+146.8%)
Mutual labels:  npm-package, browser
Console.md
Ever dreamed of rendering Markdown in the console? No. Neither had I.
Stars: ✭ 24 (-88.18%)
Mutual labels:  console, browser
Leash
Browser Shell
Stars: ✭ 108 (-46.8%)
Mutual labels:  console, browser
Frontendwingman
Frontend Wingman, Learn frontend faster!
Stars: ✭ 315 (+55.17%)
Mutual labels:  console, devtools
Console Badge
🎨 Create simple badges in the browser console
Stars: ✭ 130 (-35.96%)
Mutual labels:  console, browser
Vscode Browse Lite
🚀 An embedded browser in VS Code
Stars: ✭ 134 (-33.99%)
Mutual labels:  devtools, browser
Secret Agent
The web browser that's built for scraping.
Stars: ✭ 151 (-25.62%)
Mutual labels:  devtools, browser
Tfjs Yolo Tiny
In-Browser Object Detection using Tiny YOLO on Tensorflow.js
Stars: ✭ 465 (+129.06%)
Mutual labels:  npm-package, browser
Spring Boot Examples
个人学习 SpringBoot2.x 写的一些示例程序,目前正在持续更新中.....
Stars: ✭ 159 (-21.67%)
Mutual labels:  devtools, filter
Colorette
Easily set the color and style of text in the terminal.
Stars: ✭ 1,047 (+415.76%)
Mutual labels:  console, browser
Ky Universal
Use Ky in both Node.js and browsers
Stars: ✭ 421 (+107.39%)
Mutual labels:  npm-package, browser
Web Console
Simple web-based shell, remote shell in your browser
Stars: ✭ 1,344 (+562.07%)
Mutual labels:  console, browser
Log
Console.log with style.
Stars: ✭ 2,766 (+1262.56%)
Mutual labels:  console, devtools
Rawkit
🦊 Immediately Open Chrome DevTools when debugging Node.js apps
Stars: ✭ 306 (+50.74%)
Mutual labels:  devtools, browser
Marionette
Selenium alternative for Crystal. Browser manipulation without the Java overhead.
Stars: ✭ 119 (-41.38%)
Mutual labels:  devtools, browser
React Render In Browser
React library to render browser specific content
Stars: ✭ 157 (-22.66%)
Mutual labels:  npm-package, browser

filter-console

Filter out unwanted console.log() output

Can be useful when you don't control the output, for example, filtering out PropType warnings from a third-party React component.

Install

$ npm install filter-console

Usage

const filterConsole = require('filter-console');

const disableFilter = filterConsole(['🐼']);

const log = () => {
	console.log('');
	console.log('🦄');
	console.log('🐼');
	console.log('🐶');
};

log();

disableFilter();

log();
$ node example.js

🦄
🐶

🦄
🐼
🐶

API

filterConsole(excludePatterns, [options])

Returns a function, which when called, disables the filter.

excludePatterns

Type: Array<string|RegExp|Function>

Console output that matches any of the given patterns are filtered from being logged. The patterns are matched against what would be logged and not the console method input arguments directly. Meaning an exclude pattern of 'foo bar' will match console.log('foo %s', 'bar').

Filter types:

  • string: Checks if the string pattern is included in the console output.
  • RegExp: Checks if the RegExp pattern matches the console output.
  • Function: Receives the console output as a string and is expected to return a truthy/falsy value of whether to exclude it.

options

Type: Object

methods

Type: Array
Default: ['log', 'debug', 'info', 'warn', 'error']

Console methods to filter.

console

Type: Object
Default: console

Use a custom console object. Can be useful for testing or mocking.

License

MIT © Sindre Sorhus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].