Comparing version 3.6.5 to 3.7.0
@@ -5,2 +5,3 @@ var child_process = require('child_process'); | ||
var _ = require('lodash'); | ||
var snakeCase = require('lodash.snakecase') | ||
var Bluebird = require('bluebird'); | ||
@@ -113,3 +114,3 @@ var utils = require('./utils'); | ||
} else { | ||
self.parseLog(stream, stack.join('\n')); | ||
self.onLogMessage(stream, stack.join('\n')); | ||
stack = null; | ||
@@ -126,6 +127,6 @@ } | ||
if (!message) return; | ||
self.parseLog(stream, message); | ||
self.onLogMessage(stream, message); | ||
}, function () { | ||
if (stack) { | ||
self.parseLog(stream, stack.join('\n')); | ||
self.onLogMessage(stream, stack.join('\n')); | ||
stack = null; | ||
@@ -136,3 +137,3 @@ } | ||
Node.prototype.parseLog = function (stream, message) { | ||
Node.prototype.onLogMessage = function (stream, message) { | ||
var msgObj = this.parseLine(stream, message); | ||
@@ -145,3 +146,3 @@ | ||
if (msgObj.type.match(/(^|\.)node$/) && msgObj.message === 'started') { | ||
if (msgObj.type === 'node' && msgObj.message === 'started') { | ||
this.emit('start', this); | ||
@@ -151,6 +152,12 @@ this.name = msgObj.node; | ||
if (msgObj.type.match(/(^|\.)http$/) && /publish_address/.test(msgObj.message)) { | ||
if (!this.parsePort(msgObj.message)) { | ||
var typeHttp = ['http', 'http_server'].indexOf(msgObj.type) > -1 | ||
var httpAddressPublished = typeHttp && /publish_address/.test(msgObj.message) | ||
if (httpAddressPublished) { | ||
var port = this.parsePublishAddress(msgObj.message); | ||
if (!port) { | ||
this.emit('log', 'error', 'unable to parse node port from ' + msgObj.message); | ||
return; | ||
} else { | ||
this.address = port.address; | ||
this.port = port.port; | ||
} | ||
@@ -176,6 +183,17 @@ } | ||
if (matches = line.match(/^\[([^\]]+)\]\[([^\]]+)\]\[([^\]]+)\]\s*\[([^\]]+)\](.+)/)) { | ||
var type = matches[3].trim() | ||
if (/^(\w\.)+\w{2,}/.test(type)) { | ||
// 5.x-ish version log the type as a class name with short-dot style prefixes | ||
// ie: o.e.n.Node, o.e.t.TransportService | ||
// so we trim those down to just the class name | ||
const relevantParts = type.split('.') | ||
while (relevantParts.length && relevantParts[0].length <= 1) relevantParts.shift() | ||
type = relevantParts.join('.') | ||
} | ||
return { | ||
timestamp: moment(matches[1].trim(), 'YYYY-MM-DD HH:mm:ss,SSS').toDate(), | ||
level: matches[2].trim(), | ||
type: matches[3].trim(), | ||
type: snakeCase(type), | ||
node: matches[4].trim(), | ||
@@ -207,8 +225,9 @@ message: matches[5].trim() | ||
Node.prototype.parsePort = function (message) { | ||
Node.prototype.parsePublishAddress = function (message) { | ||
var matches = message.match(/publish_address\s*\{[^\}]*?(\d+\.\d+\.\d+\.\d+):(\d+)[^\}]*\}/i); | ||
if (matches) { | ||
this.address = matches[1]; | ||
this.port = matches[2]; | ||
return true; | ||
return { | ||
address: matches[1], | ||
port: matches[2] | ||
} | ||
} | ||
@@ -215,0 +234,0 @@ }; |
{ | ||
"name": "libesvm", | ||
"version": "3.6.5", | ||
"version": "3.7.0", | ||
"description": "libesvm is a library for managning an Elasticsearch process for development and testing.", | ||
@@ -36,2 +36,3 @@ "main": "index.js", | ||
"lodash.set": "^4.1.0", | ||
"lodash.snakecase": "^4.1.1", | ||
"mkdirp": "~0.5.0", | ||
@@ -38,0 +39,0 @@ "moment": "^2.7.0", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
74675
2114
10
23
+ Addedlodash.snakecase@^4.1.1
+ Addedlodash.snakecase@4.1.1(transitive)