bunyan-decorator
Advanced tools
Comparing version 1.0.4 to 1.0.6
{ | ||
"name": "bunyan-decorator", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,10 +23,8 @@ #bunyan-decorator | ||
// Now decorator you class method | ||
// Now decorator your class method to log it | ||
class MyClass { | ||
@log(Level.info) | ||
searchById(req, res) { | ||
return req.services[this._serviceClass] | ||
.byId(req.params.id) | ||
.then(json(res)) | ||
.catch(error(res)); | ||
searchById(id) { | ||
return MySearchService.byId(id); | ||
} | ||
@@ -39,11 +37,9 @@ } | ||
``` | ||
```javascript | ||
class MyClass { | ||
// This extractor ensure the promise result is not logged | ||
// This extractor will transform the result nil, thus not return value is logged | ||
@log(Level.info, { extractor: result => {} }) | ||
searchById(req, res) { | ||
return req.services[this._serviceClass] | ||
.byId(req.params.id) | ||
.then(json(res)) | ||
.catch(error(res)); | ||
searchById(id) { | ||
return MySearchService.byId(id); | ||
} | ||
@@ -50,0 +46,0 @@ } |
6023
99