1.0.0 • Published 4 years ago

stdio-capture v1.0.0

Weekly downloads
33
License
MIT
Repository
-
Last release
4 years ago

stdio-capture

Captures stdout and stderr events.

Does not capture console.log or console.error called within event handler.

Usage

const capture = require('stdio-capture')

const capture = require('.')

capture.on('stdout', text => {
  console.log(`I just captured "${text}" from stdout!`)
  console.log('But this text will not be captured.')
})

capture.on('stderr', text => {
  console.log(`I just captured "${text}" from stderr!`)
  console.log('But this text will not be captured.')
})

capture.enable()

console.log('This text')
console.error('Also this text')

capture.disable()

console.log('But not this text')
console.error('Or this text')