npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aws-cwlogger

v1.0.1

Published

AWS CloudWatch Logger - log events in amazon log stream

Downloads

9

Readme

AWS CloudWatch LOGGER Build Status

This is simple logger to send logs into AWS CloudWatch Logs stream.

Usage:

const CWLogger = require('aws-cwlogger');
const logger = new CWLogger({
  // AWS access
  accessKeyId: "XXXXXXXXXXXXXXXXXXXX",
  secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  region: "eu-central-1",
  // Logs destination
  groupName: "test_group",
  streamName: "test_stream"
});

logger.log('Text message');
logger.info({text: 'Supported all data types!'});
logger.warn(['Including'], {_: 'multiple arguments'});
logger.error(false);

logger.cat('category-name').log('Categories supported.');
logger.cat('category-name').info('with');
logger.cat('category-name').warn('all 4');
logger.cat('category-name').error('methods');

After that you should see in console:

Text message
{ text: 'Supported all data types!' }
[ 'Including' ] { _: 'multiple arguments' }
false
<<category-name>>: Categories supported.
<<category-name>>: with
<<category-name>>: all 4
<<category-name>>: methods

And in AWS console - CloudWatch - Logs:

AWS CloudWatch logs screen

Options:

| Param | Type | Description | |-------------------|---------------|-------------| | enabled | {boolean} | Enable sending logs to CloudWatch (default: true). Leave the option false to don't save logs into CloudWatch Logs | | accessKeyId* | {string} | AWS API key (not required if enabled === false) | | secretAccessKey* | {string} | AWS API secret (not required if enabled === false) | | region* | {string} | AWS region (default: eu-central-1) (not required if enabled === false) | | groupName* | {string} | CloudWatch log group name (not required if enabled === false) | | streamName* | {string} | CloudWatch log stream name in group (not required if enabled === false) | | consolePrint | {boolean} | Print errors into console (default: true) | | flushDelay | {number} | Delay in ms. between sending messages (default: 1000) | | maxBatchCount | {number} | Max messages to send in butch (default: 5000) | | maxBatchSize | {number} | The maximum batch size (default: 1000000) |

P.S. IAM user should have permissions for actions
["logs:DescribeLogGroups","logs:DescribeLogStreams","logs:PutLogEvents"]
P.P.S. Do not use root user for the security reasons!

INSTALL

npm install aws-cwlogger --save

RUN TESTS

1. Create CloudWatch Logs group and stream:

  1. Go to "AWS Console" - "Services" - "CloudWatch" - Tab "Logs"
  2. Create group (ex. cwlogger-test)
  3. Go to created group and create stream (ex. test)
  4. Go back to tab "Logs" and enabled column "ARN" in table.
  5. Copy your group's ARN in clipboard, you need it on the next step.

2. Create AWS IAM user (ex. cwlogger-test)

  • Make checked Programmatic access
  • Don't check AWS Management Console access

With permission:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:DescribeLogGroups",
                "logs:DescribeLogStreams",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "arn:aws:logs:eu-central-1:665544332211:log-group:cwlogger-test:*"
            ]
        }
    ]
}

Don't forget to replace "Resource" with your ARN.

3. Configure test

cp test/config/example.config.js test/config/config.js
nano test/config/config.js

4. Run tests

npm install
npm test

LICENSE

MIT