Skip to content

alexshevch/js-console-var

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

console-var

Node.js package to store console.log output in a variable.

General idea

When you pass a function to console-var it executes your function and returns what the function was logging.

This allows parsing the log right after function execution, testing what the function is logging, or redirecting the log to another stream.

Installation

npm install console-var --save

Usage

var cvar = require('console-var');

function logHello () {
    console.log("Hello World!");
}

var consoleOutput = cvar(logHello);

Coming-soon improvements

  • option to return logs in different formats
  • option to capture console.err
  • return function log alongside its regular return value
  • ability to pass in more than one function
  • in-browser console log support

Stay tuned!

License

MIT

About

Store console.log output in a variable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published