The plugin example in README doesn't support variadic arguments, so writing plugins based on the example won't work as expected (In case the user wants to do log.error('foo', 'bar') instead of log.error('foobar')).
Maybe something like this would be better:
return function () {
var messages = ["Newsflash: "];
for (var i = 0; i < arguments.length; i++) {
messages.push(arguments[i]);
}
rawMethod.apply(undefined, messages);
};
Sure, it looks a lot more complicated. Maybe including both of the examples would be best.
Hi,
The plugin example in README doesn't support variadic arguments, so writing plugins based on the example won't work as expected (In case the user wants to do
log.error('foo', 'bar')
instead oflog.error('foobar')
).Maybe something like this would be better:
Sure, it looks a lot more complicated. Maybe including both of the examples would be best.