From 061cffe462c2b14b4e2991b1a9178e3fce53f1d4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Sat, 14 May 2016 12:51:52 +0200 Subject: [PATCH] transform and pass through the existing store --- storage/LogStore.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/storage/LogStore.js b/storage/LogStore.js index d588c82f5..14761e6b7 100644 --- a/storage/LogStore.js +++ b/storage/LogStore.js @@ -8,11 +8,12 @@ var create = module.exports.create = function(filePath, backingStore) { var file = Fs.createWriteStream(filePath, {flags: 'a+'}); - return { - message: function(channel, msg, callback) { - message(file, msg); - backingStore.message(channel, msg, callback); - }, - getMessages: backingStore.getMessages + var originalMessageFunction = backingStore.message; + + backingStore.message = function(channel, msg, callback) { + message(file, msg); + originalMessageFunction(channel, msg, callback); }; + + return backingStore; };