Skip to content

Commit

Permalink
added custom logging function option
Browse files Browse the repository at this point in the history
  • Loading branch information
odbol committed Oct 25, 2012
1 parent b41e3fd commit 0c0a032
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/connect-memcached.js
Expand Up @@ -50,6 +50,8 @@ module.exports = function(connect){
*/

function MemcachedStore(options) {
var log = options.loggingFunction || console.log;

options = options || {};
Store.call(this, options);
if (!options.hosts) {
Expand All @@ -61,10 +63,10 @@ module.exports = function(connect){
}

this.client = new Memcached(options.hosts, options);
console.log("MemcachedStore initialized for servers: " + options.hosts);
log("MemcachedStore initialized for servers: " + options.hosts);

this.client.on("issue", function(issue) {
console.log("MemcachedStore::Issue @ " + issue.server + ": " +
log("MemcachedStore::Issue @ " + issue.server + ": " +
issue.messages + ", " + issue.retries + " attempts left");
});
};
Expand Down

0 comments on commit 0c0a032

Please sign in to comment.