acho-trace
It Envolves async/sync methods for automatically logs traces. Inspired in Apex log.
Install
$ npm install acho-trace --save
Usage
First load the plugin:
const Acho = require('acho')
Acho = require('acho-trace')(Acho)
Now when you call Acho
for create a new instance, the new instance will have .trace
and .traceSync
methods for envolve functions and create traces.
For see it in action check examples.
API
The API provides to endpoints:
both methods follow the same interface:
'use strict'
var Acho = require('acho')
Acho = require('acho-trace')(Acho)
var acho = Acho()
var fn = createFnAsync()
var wrapFnOne = acho.trace(fn, {
sync: false,
level: 'debug',
levelErr: 'error',
context: '',
trace: function (obj) {
return ['executed fn with params: %j', obj]
},
traceErr: function (err) {
return ['something bad happens: %s', err.message]
}
})
License
MIT © Kiko Beats