Socket
Socket
Sign inDemoInstall

aliyun-sls-stream

Package Overview
Dependencies
22
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aliyun-sls-stream

阿里云 SLS PutLogs Stream


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

阿里云 SLS Stream

阿里云 SLS PutLogs Stream

使用方法

  1. 直接使用
const AliyunSlsStream = require('aliyun-sls-stream')

const stream = new AliyunSlsStream({
  accessKeyId: 'your_very_secured_access_key_id',
  secretAccessKey: 'your_very_secured_secret_access_key',
  endpoint: 'an_aliyun_endpoint_for_sls', // refer to https://help.aliyun.com/document_detail/29008.html?spm=5176.doc28984.2.5.CMkSh1 for more details
  project: process.env.ALIYUN_PROJECT,
  logStore: process.env.ALIYUN_LOG_STORE
})

stream.write('Hello from the other side')
stream.write({ foo: 'bar' })

  1. 通过 bunyan 使用
const bunyan = require('bunyan')
const AliyunSlsStream = require('aliyun-sls-stream')

const log = bunyan.createLogger({
  name: 'foo',
  streams: [{
    type: 'raw',
    stream: new AliyunSlsStream({
      accessKeyId: 'your_very_secured_access_key_id',
      secretAccessKey: 'your_very_secured_secret_access_key',
      endpoint: 'an_aliyun_endpoint_for_sls', // refer to https://help.aliyun.com/document_detail/29008.html?spm=5176.doc28984.2.5.CMkSh1 for more details
      project: process.env.ALIYUN_PROJECT,
      logStore: process.env.ALIYUN_LOG_STORE
    }),
    reemitErrorEvents: true
  }],
  level: 'debug'
})

log.debug('foobar')
log.debug({ foo: 'bar' }, 'foobar')
log.debug({ foo: 'bar' }, 'foobar: %s', ['foo', 'bar'])

FAQs

Last updated on 29 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc