console-capture

0.0.3 • Public • Published

console-capture

Codeship Status for sytac/gulp-commonjs-tasks

Description

Captures console and restores it at a later moment.

Why?

I walked into a situation where I have to validate the existence of a log file stored in a system variable before I can fire up a proper logger. If either the system variable or the log file will not exist I have to abort the process. If not, I have to write the location of the log file to the logs.

Installation

$ npm install --save console-capture

Usage

If you'd like to try the examples, please link the module first by running gulp prepare-examples

// ./examples/capture/index.js
 
'use strict';
 
var consoleCapture = require('console-capture');
consoleCapture.trap();
 
console.log('1 Mississippi');
console.log('2 Mississippi');
console.log('3 Mississippi');
console.dir({
  pizza: 'yummy'
});
console.trace(new Error('omg'));
 
consoleCapture.restore();
 

Running tests

$ gulp test

Test reports are written to ./reports.

Contributing

  • Do pull requests.
  • Make sure there's tests and meaningful coverage.
  • Respect ./eslintrc.
  • Issues should go in issues.

Readme

Keywords

none

Package Sidebar

Install

npm i console-capture

Weekly Downloads

5

Version

0.0.3

License

MIT

Last publish

Collaborators

  • jpwesselink