sbx-service-logger
v0.6.2
Published
Send your errors and additional info to logger service. Send type, requestId, serviceName, serviceId and error trace or your message
Downloads
103
Readme
sbx-service-logger
Send your errors and additional info to logger service.
Send type, requestId, serviceName, serviceId and error trace or your message
Usage
To send all unhandled errors
const {ServiceBroker, Middlewares} = require('moleculer')
const {middleware} = require('sbx-service-logger')
Middlewares.Logger = middleware
const broker = new ServiceBroker({
middlewares: [
'Logger',
],
})
If you want to send some additional info you need to use logger
const {ServiceBroker, Middlewares} = require('moleculer')
const {middleware, logger} = require('sbx-service-logger')
Middlewares.Logger = middleware
const broker = new ServiceBroker({
middlewares: [
'Logger',
],
logger
})
this.broker.getLogger().info('some info')