Last active
December 20, 2015 19:09
-
-
Save chrisabrams/6181585 to your computer and use it in GitHub Desktop.
Write console.logs from your app/tests running in Mocha to a file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require 'fs' | |
util = require "util" | |
log = fs.createWriteStream(process.cwd() + "/test/stdout.log") | |
console.log = console.info = (t) -> | |
out = undefined | |
if t and ~t.indexOf("%") | |
out = util.format.apply(util, arguments) | |
process.stdout.write out + "\n" | |
return | |
else | |
out = Array::join.call(arguments, " ") | |
out and log.write(out + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment