Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-aws-cloudwatch

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-aws-cloudwatch

A Winston transport for Amazon CloudWatch.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.5K
increased by10.94%
Maintainers
1
Weekly downloads
 
Created
Source

winston-aws-cloudwatch

npm Dependencies Build Status Coverage Status JavaScript Standard Style

A Winston transport for Amazon CloudWatch.

Usage

var CloudWatchTransport = require('winston-aws-cloudwatch')

winston.add(CloudWatchTransport, {
  logGroupName: '...', // REQUIRED
  logStreamName: '...', // REQUIRED
  createLogGroup: true,
  createLogStream: true,
  awsConfig: {
    accessKeyId: '...',
    secretAccessKey: '...',
    region: '...'
  },
  formatLogItem: function (item) {
    return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
  }
})

Error Handling

If, for any reason, logging to CloudWatch should fail, then the transport will emit an error event. It is recommended that you subscribe to this event to avoid crashes. Here's a basic example:

var config = { ... } // See above
var cwt = new CloudWatchTransport(config)

cwt.on('error', function (error) {
  console.error('Error logging to CloudWatch: ' + error.message)
})

winston.add(cwt)

But Why?

As you may have noticed, there is also winston-cloudwatch, which predates this module. After making some contributions to that one, I felt like writing my own version. Feel free to use whichever you like best.

Author

Tim De Pauw

License

MIT

Keywords

FAQs

Package last updated on 12 Jun 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc