Created
March 7, 2017 23:51
-
-
Save brettinternet/2f349bb55f1d5011a3b98c8de456dbfb to your computer and use it in GitHub Desktop.
Debugging in node with a lightweight logger
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
const fs = require('fs'), | |
util = require('util'), | |
file = fs.createWriteStream(__dirname + '/error.log', {flags : 'w'}), | |
sout = process.stdout, | |
err = d => { | |
file.write(util.format(d) + '\n') | |
sout.write(util.format(d) + '\n') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment