[Pkg-javascript-commits] [node-ain2] 27/102: Default to OS hostname and 127.0.0.1 address, unless hostname is set

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 57cb63939ffc8b5549b3c38514f806372679ef69
Author: Mark Wubben <mark at novemberborn.net>
Date:   Tue Sep 13 15:31:54 2011 +0100

    Default to OS hostname and 127.0.0.1 address, unless hostname is set
---
 index.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index 63ff166..291b49d 100644
--- a/index.js
+++ b/index.js
@@ -2,7 +2,8 @@ var dgram = require('dgram');
 var Buffer = require('buffer').Buffer;
 var nodeConsole = console;
 
-var OsHostname = require("os").hostname();
+var DefaultHostname = require("os").hostname();
+var DefaultAddress = "127.0.0.1";
 
 var Facility = {
     kern:   0,
@@ -134,7 +135,12 @@ SysLogger.prototype.setFacility = function(facility) {
     return this;
 };
 SysLogger.prototype.setHostname = function(hostname) {
-    this.hostname = hostname || OsHostname;
+    if (hostname) {
+      this.hostname = this.address = hostname;
+    } else {
+      this.hostname = DefaultHostname;
+      this.address = DefaultAddress;
+    }
     return this;
 };
 
@@ -166,7 +172,7 @@ SysLogger.prototype._send = function(message, severity) {
                 0,
                 message.length,
                 this.port,
-                this.hostname,
+                this.address,
                 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