0.1.1 • Published 6 years ago

console-suppress v0.1.1

Weekly downloads
272
License
MIT
Repository
github
Last release
6 years ago

Console Suppress

Augments console methods with message suppressing capabilities. Very useful during testing.

Build status

Installation

This package is available on npm as: console-suppress

npm install --dev console-suppress

Basic usage

import console from 'console-suppress'

console.log.suppress(/undesired/)
console.log('some undesired log') // not logged to the console.

API

At the context of this documentation, suppressor means either a RegExp instance, a string (which will eventually be converted to a regex for comparison) or an array of the previous two.

Adding suppressors:

MethodArgumentsDescription
console.suppresssuppressorRegisters a suppressor for all method calls.
console.log.suppresssuppressorRegisters a suppressor for console.log calls.
console.info.suppresssuppressorRegisters a suppressor for console.info calls.
console.warn.suppresssuppressorRegisters a suppressor for console.warn calls.
console.error.suppresssuppressorRegisters a suppressor for console.error calls.

Removing suppressors:

MethodArgumentsDescription
console.cleanSuppressorsuppressorRemoves the given suppressor for any logging method calls.
console.log.cleanSuppressorsuppressorRemoves the given suppressor for console.log calls.
console.info.cleanSuppressorsuppressorRemoves the given suppressor for console.info calls.
console.warn.cleanSuppressorsuppressorRemoves the given suppressor for console.warn calls.
console.error.cleanSuppressorsuppressorRemoves the given suppressor for console.error calls.
console.cleanSuppressorssuppressorRemoves given suppressors (or all, if none provided) any logging method calls.
console.log.cleanSuppressorssuppressorRemoves given suppressors (or all, if none provided) for console.log calls.
console.info.cleanSuppressorssuppressorRemoves given suppressors (or all, if none provided) for console.info calls.
console.warn.cleanSuppressorssuppressorRemoves given suppressors (or all, if none provided) for console.warn calls.
console.error.cleanSuppressorssuppressorRemoves given suppressors (or all, if none provided) for console.error calls.