rupyy-logger
v1.0.12
Published
This is an application to store logs in aws cloudwatchlosgs
Downloads
17
Readme
Rupyy Logger
Rupyy Logger is an npm package to store data to AWS CloudWatch Logs using aws-sdk latest version.
Installation
Install the package using npm:
npm i rupyy-logger
Usage
Before using the addLogs function, you need to set up the AWS credentials and log configuration. Here's an example of how to use the package:
const cloudwatchLogger = require('rupyy-logger');
// Set up your AWS CloudWatch configuration
const config = {
logGroupName: 'YourLogGroupName',
logStreamName: 'YourLogStreamName',
awsRegion: 'YourAWSRegion',
awsAccessKeyId:'YourAWSAccessKeyId',
awsSecretKey:'YourAWSSecretKey'
};
// Your log data
const logData = {
level: 'info / error',
req_id: '12345', // Unique Id
purpose: 'Some purpose for this log',
context: 'Some context for this log',
logData: {
// Additional log data if needed
},
};
// Call the addLogs function to log the data to AWS CloudWatch
try {
cloudwatchLogger(config, logData);
} catch (error) {
console.error('Error:', error.message);
}