1.0.1 • Published 7 years ago

bunyan-aliyun v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

bunyan-aliyun

npm

Adapt bunyan logger to Aliyun Log Service API of logger is the same as bunyan.(Actually it's bunyan's logger)

Quick start

$ npm install bunyan-aliyun
const BunyanFactory = require('bunyan-aliyun');
const factory = new BunyanFactory({
    accessKey: 'your access key',
    secretKey: 'your secret access key',
    endpoint: 'your endpoint',
    projectName: 'your project name',
    logStoreName: 'your logstore name'
});

const logger = factory.createLogger('testLogger');
logger.info('foo', 'bar');

Usage

Events

Report event will be emitted after the stream reported logs to aliyun successfully.

logger.on('report', (result) => {})

Methods

Initialize logger factory

new BunyanFactory({
    accessKey: 'your access key',
    secretKey: 'your secret access key',
    endpoint: 'your endpoint',
    projectName: 'your project name',
    logStoreName: 'your logstore name'
})

Create logger

factory.createLogger(name, level)