Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filter-console

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-console

Filter out unwanted `console.log()` output

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
150K
decreased by-11.57%
Maintainers
1
Weekly downloads
 
Created

What is filter-console?

The filter-console npm package allows you to filter out unwanted console output in Node.js applications. This can be particularly useful for suppressing noisy logs or warnings that are not relevant to your current debugging or logging needs.

What are filter-console's main functionalities?

Filter specific messages

This feature allows you to filter out specific messages from the console output. In the example, any console warnings or errors that match the specified patterns will be suppressed.

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

filterConsole(['Warning: ...', 'Deprecation notice: ...']);

console.log('This will be shown');
console.warn('Warning: This will be filtered');
console.error('Deprecation notice: This will also be filtered');

Filter using regular expressions

This feature allows you to use regular expressions to filter out console messages. This is useful for more complex filtering needs where the exact message may vary.

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

filterConsole([/Warning: .*/, /Deprecation notice: .*/]);

console.log('This will be shown');
console.warn('Warning: This will be filtered');
console.error('Deprecation notice: This will also be filtered');

Unfilter messages

This feature allows you to temporarily filter messages and then unfilter them when needed. The `unfilter` function restores the original console behavior.

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

const unfilter = filterConsole(['Warning: ...']);

console.log('This will be shown');
console.warn('Warning: This will be filtered');

unfilter();

console.warn('Warning: This will be shown again');

Other packages similar to filter-console

Keywords

FAQs

Package last updated on 26 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc