Permalink
Browse files

.verbose option on connection objects to print executed commands to c…

…onsole
  • Loading branch information...
1 parent 3bafb8d commit 21ba19d185b9886e2c955952965954ed909e8da6 @hdachev committed Apr 14, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/connection.js
View
@@ -287,6 +287,9 @@ exports.Connection = function ( backend, minLatency, maxLatency )
var q = queue, entry, func, out, err, data, resp = [];
queue = null;
+ if ( connection.verbose )
+ console.log ( '\n' );
+
if ( q ) while (( entry = q.shift () ))
{
if ( entry === 'SKIP' )
@@ -295,6 +298,9 @@ exports.Connection = function ( backend, minLatency, maxLatency )
func = backend [ entry.command ];
out = null;
+ if ( connection.verbose )
+ console.log ( "fakeredis>", entry.command, entry.args.join ( ' ' ) );
+
if ( entry.override )
{
out = entry.override ( q );
@@ -349,6 +355,9 @@ exports.Connection = function ( backend, minLatency, maxLatency )
resp.push ( entry.callback.bind ( null, err, data ) );
}
+ if ( connection.verbose )
+ console.log ( '\n' );
+
if ( resp.length )
flush ( resp );
}

0 comments on commit 21ba19d

Please sign in to comment.