Permalink
Browse files

Logging on polling

  • Loading branch information...
1 parent 7b83a3a commit c456972b2d22ac07292ce39e377d9785e911eac0 @christav christav committed Mar 16, 2013
Showing with 8 additions and 1 deletion.
  1. +3 −1 lib/servicebusconnector.js
  2. +5 −0 test/logging-tests.js
View
4 lib/servicebusconnector.js
@@ -48,7 +48,9 @@ ServiceBusConnector.prototype.start = function () {
function pollSb() {
self.serviceBusReceiver.receiveSubscriptionMessage(self.topic, self.subscription, function (err, receivedMessage) {
- self.emit('poll', err, receivedMessage);
+ if (err === 'No messages to receive') {
+ self.log && self.log.debug('Service Bus poll: no message');
+ }
if (!err) {
var msg = self.unpackMessage(receivedMessage);
View
5 test/logging-tests.js
@@ -79,6 +79,11 @@ describe('logging', function () {
recvNothing();
});
+ it('should log when poll completes without a message', function () {
+ recvNothing();
+ logger.debug.calledWith('Service Bus poll: no message').should.be.true;
+ });
+
// Helpers for sending messages
function recvNothing() {
var recvFunc = recvFuncs.shift();

0 comments on commit c456972

Please sign in to comment.