You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Merge pull request #823 from fintura/debug
Refactor debug mode not to break old code and to work with NODE_DEBUG too
This commit is contained in:
15
index.js
15
index.js
@@ -14,16 +14,13 @@ var net = require("net"),
|
|||||||
connection_id = 0,
|
connection_id = 0,
|
||||||
default_port = 6379,
|
default_port = 6379,
|
||||||
default_host = "127.0.0.1",
|
default_host = "127.0.0.1",
|
||||||
debug;
|
debug = function(msg) {
|
||||||
|
if (exports.debug_mode) {
|
||||||
|
console.error(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* istanbul ignore next */
|
exports.debug_mode = /\bredis\b/i.test(process.env.NODE_DEBUG);
|
||||||
if (util.debuglog) {
|
|
||||||
debug = util.debuglog('redis');
|
|
||||||
} else if (/\bredis\b/i.test(process.env.NODE_DEBUG)) {
|
|
||||||
debug = console.error;
|
|
||||||
} else {
|
|
||||||
debug = function() {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// hiredis might not be installed
|
// hiredis might not be installed
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user