lazywithclass / winston-cloudwatch

Send logs to Amazon Cloudwatch using Winston.
MIT License
258 stars 105 forks source link

Fix: Create log groups when missing #184

Closed dev-guy closed 2 years ago

dev-guy commented 2 years ago

Overview

When the ensureLogGroup option is true, the log group will be created if it is missing.

Changes

Use err.name instead of err.code for AWS errors. This appears to be a consequence of using @aws-sdk (v3) instead of aws-sdk (v2).

terrisgit commented 2 years ago

This is published to npm at https://www.npmjs.com/package/@goodware/winston-cloudwatch and will be taken down as soon as this issue is resolved. I need Winston-cloudwatch to be able to create log groups. By the way, the unit tests pass with the PR - previously they did not.

ivikash commented 2 years ago

When ensureLogGroup is true and logGroupName & logStreamName is not present in Amazon CloudWatch then winston-cloudwatch is unable to create the log and constantly throws the error - ResourceNotFoundException.

As per my testing, this PR fixes the issue. @dev-guy Thank-You for the PR 🏆

@lazywithclass Waiting for the next release 👍

lazywithclass commented 2 years ago

I thought I already added this change, thanks a lot for your efforts.

You will find this in winston-cloudwatch@6.0.0; as always sorry for being so late with the release.

ivikash commented 2 years ago

Thank-You!