dd-stan-logger

    1.0.8 • Public • Published

    dd-stan-logger

    A simple repository to publish logs to provided NATS connection.

    Usage

    const  stan = require('node-nats-streaming');
    const  connection = stan.connect('test-cluster', 'test');
    
    connection.on('connect', () => {
    	console.log('>>> nats-streaming-server connected for publishing!');
    	
    	let  logger = require('dd-stan-logger')(connection,'subject_name');
    	logger.setLogLevel("debug");
    	logger.info('TID', 'ReqCorIdd', 'a test log msg', '{"input": "test"}', '{"output": "test"}', 600, (d) =>  console.log(d));
    	logger.log('warn', 'TID', 'ReqCorIdd', 'a test log msg', '{"input": "test"}', '{"output": "test"}', 600, (d) =>  console.log(d));
    });
    

    Note: Refer to driver folder for example

    Methods

    • error
    • warn
    • info
    • http
    • verbose
    • debug
    • silly
    • log (takes log level as 1st parameter)
    • getLogLevel (return current log level of the logger instance)
    • setLogLevel (assigns log level for the logger instance)

    To-Do

    • create NATS connection if no connection is provided
    • add event handler for reconnecting if connection is lost

    Keywords

    none

    Install

    npm i dd-stan-logger

    DownloadsWeekly Downloads

    14

    Version

    1.0.8

    License

    ISC

    Unpacked Size

    19.3 kB

    Total Files

    10

    Last publish

    Collaborators

    • ankit1329