@railtownai/bunyan-railtownai
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

bunyan-railtownai

bunyan-railtownai is a bunyan stream to ship your logs to railtown.ai

Install

$ npm install @railtownai/bunyan-railtownai

Options

  • token: Your railtown token [required]

Usage

const bunyan = require('bunyan');
const BunyanRailtownAi = require('@railtownai/bunyan-railtownai');


const log = bunyan.createLogger({
  name: 'myapp',
  stream: new BunyanRailtownAi({
    token: 'your_token_here',
  }),
});

//or use environment variable 'RAILTOWN_TOKEN' and call it without the token key

const log = bunyan.createLogger({
  name: 'myapp',
  stream: new BunyanRailtownAi(),
});

Manually Logging Errors with additional properties

Import bunyanLogger and use as follows:

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

    bunyanLogger.error(logError, error.message);
}

Package Sidebar

Install

npm i @railtownai/bunyan-railtownai

Weekly Downloads

1

Version

1.0.10

License

MIT

Unpacked Size

9.68 kB

Total Files

5

Last publish

Collaborators

  • mbrailtown
  • jbueza-railtownai
  • marwanhaddad
  • chrisgirard