0.0.0 • Published 2 years ago

log4js-test-francisco v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Log4JS - Railtownai Appender

Installation

npm i @railtownai/log4js-railtownai

Configuration

  • type - @railtownai/log4js-railtownai
  • token - string - railtown token

Example

log4js.configure({
  appenders: {
    railtownai: {
      type: '@railtownai/log4js-railtownai',
      token: 'your_token_here',
    },
  },
  categories: { default: { appenders: ['railtownai'], level: 'error' } },
});

Manually Logging Errors with additional properties

Import log4jsLogger and use as follows:

try {
  // code to try 
} catch (error) {
    const logError = {
      err: error,
      userId: '123456789',
      projectId:'abcdefg'
    };

  log4jsLogger.error(logError);
}

This will send log messages to railtownai.