fwsp-logger
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -7,3 +7,5 @@ 'use strict'; | ||
const hydraOpts = (opts, hydra) => { | ||
let augment = {serviceName: opts.serviceName}; | ||
let augment = { | ||
serviceName: opts.serviceName | ||
}; | ||
if (opts.augment) { | ||
@@ -55,9 +57,5 @@ opts.augment = Object.assign(opts.augment, augment); | ||
initLogger() { | ||
this._logger = new HydraPinoLogger( | ||
Object.assign( | ||
{serviceName: this.hydraConfig.serviceName}, | ||
this.opts | ||
), | ||
this.hydra | ||
); | ||
this._logger = new HydraPinoLogger(Object.assign({ | ||
serviceName: this.hydraConfig.serviceName | ||
}, this.opts), this.hydra); | ||
} | ||
@@ -75,14 +73,4 @@ /** | ||
onServiceReady() { | ||
this.hydra.on('log', entry => { | ||
if (typeof(entry.msg) === 'object') { | ||
const entryObj = entry.msg; | ||
entry.msg = entryObj.message ? entryObj.message : JSON.stringify(entryObj); | ||
if (entryObj.stack) { | ||
entry.stack = entryObj.stack; | ||
} | ||
} | ||
this._logger.pino[entry.type](entry); | ||
}); | ||
this.hydra.on('log', entry => | ||
this._logger.pino[entry.type.toLowerCase()](entry)); | ||
} | ||
@@ -89,0 +77,0 @@ } |
'use strict'; | ||
const pino = require('pino'); | ||
const spawn = require('cross-spawn'); | ||
const fork = require('child_process').fork; | ||
const PassThrough = require('stream').PassThrough; | ||
@@ -166,7 +166,4 @@ const fs = require('fs'); | ||
initTransport(es) { | ||
let args = es ? ['-H', es.host, '-p', es.port] : null; | ||
if (es.index) { | ||
args.push('-i', es.index); | ||
} | ||
this.esTransport = spawn('pino-elasticsearch', args); | ||
this.esTransport = fork(`${__dirname}/esTransport`, { silent: true }); | ||
this.esTransport.send(es); | ||
this.esTransport.on('error', err => { | ||
@@ -173,0 +170,0 @@ throw new Error(`Failed to start pino-elasticsearch: ${err}`); |
{ | ||
"name": "fwsp-logger", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": { | ||
@@ -24,13 +24,13 @@ "name": "Eric Adum", | ||
"chokidar": "1.7.0", | ||
"cross-spawn": "5.1.0", | ||
"hydra-express-plugin": "0.0.1", | ||
"hydra-plugin": "0.0.1", | ||
"lodash": "4.17.4", | ||
"pino": "4.5.2", | ||
"pino": "4.5.3", | ||
"pino-elasticsearch": "2.0.1", | ||
"pino-http": "2.6.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "3.5.0", | ||
"chai": "4.0.0", | ||
"eslint": "3.19.0", | ||
"mocha": "3.3.0" | ||
"mocha": "3.4.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
17
17564
358
1
+ Addedpino-elasticsearch@2.0.1
+ Addedasap@2.0.6(transitive)
+ Addedelasticsearch@12.1.3(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedpino@4.5.3(transitive)
+ Addedpino-elasticsearch@2.0.1(transitive)
+ Addedpromise@7.3.1(transitive)
- Removedcross-spawn@5.1.0
- Removedcross-spawn@5.1.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedpino@4.5.2(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedyallist@2.1.2(transitive)
Updatedpino@4.5.3