Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    micro-loggingpublic

    Logging

    Simple logging module for microsystems that wraps winston and continuation-local-storage.

    What we ultimately wanted to achieve is to generate microservice logs that are unique, traceable, and contain enough data to act on quickly and effectively. To create these logs: * Append a unique identifier to requests as they enter the architecture. * Identify the service that generates events. * Generate events specific to each microservice as the request enters and leaves the service. * Correlate events from each microservice to create an overall view of the request.

    Install

     npm install micro-logging
    

    Usage

      var log = require('micro-logging');
    
      log.info('hello world');
    
      log.debug('hello world', 'Meta Data')
    

    Features

    • Timestamp
    • API Name - Set as serverName in Config
    • Log Level - Set as logLevel in Config
    • Correlation id - Set as correlationid in context
    • Client Application - Set as clientapplication in context
    • Global User Id - Set as globaluserid in context
    • Message
    • Meta data

    Set Context in calling application

    var session = require('continuation-local-storage').createNamespace('request'); session.set('correlationid', req.headers.correlationid); session.set('clientapplication', req.headers.clientapplication); session.set('globaluserid', req.headers.globaluserid);

    Set Config

    serverName=Api Name logLevel=info, error, debug etc...

    External Dependencies

    • Node
    • Config

    Keywords

    none

    install

    npm i micro-logging

    Downloadslast 7 days

    0

    version

    1.0.100

    license

    MIT

    last publish

    collaborators

    • avatar