1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Added timestamp to debug traces (#1426)

* Added timestamp to debug traces

* Make it compatible with node 0.10 and 0.12
This commit is contained in:
Mario de Frutos Dieguez
2019-05-07 22:50:25 +02:00
committed by Ruben Bridgewater
parent 12265a5079
commit f384e86302
2 changed files with 4 additions and 2 deletions

View File

@@ -4,7 +4,9 @@ var index = require('../');
function debug () { function debug () {
if (index.debug_mode) { if (index.debug_mode) {
console.error.apply(null, arguments); var data = Array.prototype.slice.call(arguments);
data.unshift(new Date().toISOString());
console.error.apply(null, data);
} }
} }

View File

@@ -31,7 +31,7 @@ describe("The 'blpop' method", function () {
}); });
client.rpush('blocking list', 'initial value', helper.isNumber(1)); client.rpush('blocking list', 'initial value', helper.isNumber(1));
unhookIntercept(); unhookIntercept();
assert(/^Send 127\.0\.0\.1:6379 id [0-9]+: \*3\r\n\$5\r\nrpush\r\n\$13\r\nblocking list\r\n\$13\r\ninitial value\r\n\n$/.test(text)); assert(/Send 127\.0\.0\.1:6379 id [0-9]+: \*3\r\n\$5\r\nrpush\r\n\$13\r\nblocking list\r\n\$13\r\ninitial value\r\n\n$/.test(text));
redis.debug_mode = false; redis.debug_mode = false;
bclient.blpop('blocking list', 0, function (err, value) { bclient.blpop('blocking list', 0, function (err, value) {
assert.strictEqual(value[0], 'blocking list'); assert.strictEqual(value[0], 'blocking list');