bunyan-test-francisco
v0.0.2
Published
A bunyan stream to ship your logs to railtown.ai
Downloads
3
Maintainers
Readme
bunyan-railtownai
bunyan-railtownai is a bunyan stream to ship your logs to railtown.ai
For testing purposes only
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);
}