Comparing version 1.1.1 to 1.1.2
32
logr.js
@@ -5,4 +5,17 @@ 'use strict'; | ||
const bunyan = require('bunyan'); | ||
bunyan.prototype.child = function (options, simple) { | ||
var name; | ||
if (options && options.name) { | ||
name = options.name;delete options.name; | ||
} | ||
return bunyan.createLogger({ | ||
const child = new (this.constructor)(this, options || {}, simple); | ||
if (name) child.fields.name = name; | ||
return child; | ||
}; | ||
const logr = bunyan.createLogger({ | ||
name: 'BUNY', | ||
@@ -15,7 +28,20 @@ level, | ||
src: ( ['debug','trace'].indexOf(level) !== -1 ), | ||
}) | ||
}); | ||
return Object.defineProperty(logr, 'name', { | ||
get( ){ return this.fields.name; }, | ||
set(_){ return this.fields.name = _; } | ||
}); | ||
} | ||
function getPino(level) { | ||
return require('pino')({name: 'PINO', level}); | ||
const pino = require('pino')({name: 'PINO', level}); | ||
pino.fields = {pino}; | ||
Object.defineProperty(pino.fields, 'name', { | ||
get( ){ return this.pino.name; }, | ||
set(_){ return this.pino.name = _; } | ||
}); | ||
return pino; | ||
} | ||
@@ -22,0 +48,0 @@ |
{ | ||
"name": "em-logr", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Bunyan/Pino Logger instance ready to use", | ||
@@ -5,0 +5,0 @@ "main": "logr.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
12082
7
272