Created
February 16, 2012 20:51
-
-
Save jeroenbourgois/1847748 to your computer and use it in GitHub Desktop.
hook for stdout
This file contains hidden or 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
hook_stdout: (callback) -> | |
old_write = process.stdout.write | |
process.stdout.write = ((write) -> | |
return (string, encoding, fd) -> | |
write.apply(process.stdout, arguments) | |
winston.log('info', string) | |
callback(string, encoding, fd) | |
)(process.stdout.write) | |
return () => process.stdout.write = old_write | |
unhook: -> | |
@hook_stdout (string, encoding, fd) -> | |
util.debug('d') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment