4.0.0 • Published 4 years ago

console-spy v4.0.0

Weekly downloads
107
License
CC0-1.0
Repository
-
Last release
4 years ago

console-spy

listen in on calls to the global console object

ci

install

npm install https://pkg.mkr.sx/console-spy/4.0.0.tgz

use

var cs = require('console-spy')

var spy = cs(function () {
  // Mixin custom handlers
  this.warn = warn
  this.log = log

  // Withhold arguments
  // from the real console
  this.withholding = true
})

console.log('First message')

// spy can be disabled
spy.disable()
console.log('Second message')

// and re-enabled
spy.enable()
console.log('Third message')

// and all the console methods
// can be spied upon
console.warn('Oh no!', 123)

function log () {
  => ["First message"]
  => ["Third message"]
}

function warn () {
  => ["On no!", 123]
}

obey

CC0-1.0

4.0.0

4 years ago

3.0.0

4 years ago

2.0.0

5 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

9 years ago