[Pkg-javascript-commits] [node-ain2] 26/102: Use pre-bound function to log UDP errors

Jonas Smedegaard js at moszumanska.debian.org
Tue Apr 29 11:59:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-ain2.

commit 8bdff7c08ffc4e1c89f121290231f020b9ba8fd9
Author: Mark Wubben <mark at novemberborn.net>
Date:   Tue Sep 13 15:31:25 2011 +0100

    Use pre-bound function to log UDP errors
---
 index.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 2fab4d6..63ff166 100644
--- a/index.js
+++ b/index.js
@@ -101,6 +101,11 @@ function getDate() {
  */
 function SysLogger() {
     this._times = {};
+    this._logError = function(err, other) {
+      if(err){
+        nodeConsole.error('Cannot connect to %s:%d', this.hostname, this.port);
+      }
+    }.bind(this);
 }
 
 /**
@@ -162,11 +167,7 @@ SysLogger.prototype._send = function(message, severity) {
                 message.length,
                 this.port,
                 this.hostname,
-                function(err) {
-                  if(err){
-                    nodeConsole.error('Cannot connect to %s:%d', this.hostname, this.port);
-                  }
-                }
+                this._logError
     );
     client.close();
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ain2.git



More information about the Pkg-javascript-commits mailing list