summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorNick Sullivan <nick@sullivanflock.com>2013-05-09 18:19:02 -0700
committerBen Noordhuis <info@bnoordhuis.nl>2013-05-13 12:35:17 +0200
commit8db693a87e324d2354d253990e3f75a149c029e3 (patch)
treee6576d1e5b7e9260776967f1344c3cf8e38f2058 /lib/util.js
parent69572a3965825ecead1d5ee2cfabe3a5c981fa15 (diff)
downloadnode-new-8db693a87e324d2354d253990e3f75a149c029e3.tar.gz
util: make util.log handle non strings like console.log
util.log will fail on input that does not support .toString(). Have it use console.log() instead. Includes tests for hairy data types. Fixes #5349.
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js
index 3a05337d92..58c7312c95 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -491,8 +491,9 @@ function timestamp() {
}
-exports.log = function(msg) {
- exports.puts(timestamp() + ' - ' + msg.toString());
+// log is just a thin wrapper to console.log that prepends a timestamp
+exports.log = function() {
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};