logginator
Advanced tools
Comparing version 1.1.3 to 1.1.4
19
index.js
@@ -37,3 +37,10 @@ var fs = require('fs'); | ||
var LINUX_LOG = "/dev/log", BSD_LOG = "/var/run/log"; | ||
var knownLogTargets = [ | ||
"/dev/log", // Linux | ||
"/var/run/syslog", // OS X | ||
"/var/run/log" // BSD | ||
]; | ||
function isValidTarget(name) { | ||
return fs.existsSync(name) && fs.statSync(name).isSocket(); | ||
} | ||
@@ -44,5 +51,9 @@ options.protocol = spec.protocol || "unix"; | ||
if (!options.path) { | ||
if (fs.statSync(LINUX_LOG).isSocket()) options.path = LINUX_LOG; | ||
else if (fs.statSync(BSD_LOG).isSocket()) options.path = BSD_LOG; | ||
else { | ||
for (var i = 0; i < knownLogTargets.length; ++i) { | ||
if (isValidTarget(knownLogTargets[i])) { | ||
options.path = knownLogTargets[i]; | ||
break; | ||
} | ||
} | ||
if (!options.path) { | ||
throw new Error("Failed to find log socket path, and no such " + | ||
@@ -49,0 +60,0 @@ "path was configured in \"path\" for the syslog logger backend"); |
{ | ||
"name": "logginator", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Creates an instance of TaggedLogger", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6376
115
5