Socket
Socket
Sign inDemoInstall

bunyan-decorator

Package Overview
Dependencies
22
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 to 1.0.7

13

index.js

@@ -38,11 +38,18 @@ const bunyan = require('bunyan');

Logger.prototype.log = function (msg, level = 'info', { extractor = res => res } = {}) {
Logger.prototype.log = function (msg, level, options) {
if (options && !options.extractor) {
throw new Error('options missing extractor');
}
options = options || { extractor: res => res };
level = level || 'info';
const self = this;
// rebuild options object based on params
const opts = {};
if (isLevel(msg)) {
opts.extractor = (level && level.extractor) || extractor;
opts.extractor = (level && level.extractor) || options.extractor;
opts.level = msg;
opts.msg = null;
} else if (msg.extractor) {
opts.extractor = (msg && msg.extractor) || extractor;
opts.extractor = (msg && msg.extractor) || options.extractor;
opts.level = 'info';

@@ -49,0 +56,0 @@ opts.msg = null;

{
"name": "bunyan-decorator",
"version": "1.0.6",
"version": "1.0.7",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,7 +22,6 @@ #bunyan-decorator

class MyClass {
// Now decorator your class method to log it
class MyClass {
// Decorator your class method to log it
@log(Level.info)
searchById(id) {

@@ -54,3 +53,3 @@ return MySearchService.byId(id);

```
02:12:41.894Z INFO ecl-registration: SchoolsService.all(...) (module=SchoolsService, method=all(...), elapsedTime=428.553181)
02:12:41.894Z INFO my-app: SchoolsService.all(...) (module=SchoolsService, method=all(...), elapsedTime=428.553181)
result: [

@@ -88,3 +87,3 @@ {

```json
"name":"ecl-registration","hostname":"Carmines-MacBook-Pro-7.local","pid":58820,"level":30,"module":"ExpressServer","method":"listen","msg":"up
"name":"my-app","hostname":"Carmines-MacBook-Pro-7.local","pid":58820,"level":30,"module":"ExpressServer","method":"listen","msg":"up
and running in development @: Carmines-MacBook-Pro-7.local on port: 3003}","time":"2017-02-24T02:15:38.065Z","v":0}

@@ -91,0 +90,0 @@ {"name":"ecl-registration","hostname":"Carmines-MacBook-Pro-7.local","pid":58820,"level":30,"module":"SchoolsService","method":"all(...)","elaps

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc