sbx-service-logger

    0.6.1 • Public • Published

    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')

    Install

    npm i sbx-service-logger

    DownloadsWeekly Downloads

    36

    Version

    0.6.1

    License

    ISC

    Unpacked Size

    5.31 kB

    Total Files

    3

    Last publish

    Collaborators

    • v.sobix