New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rettersoft/retter-log

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rettersoft/retter-log - npm Package Compare versions

Comparing version

to
1.2.0

47

dist/index.js

@@ -6,6 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const { EVENT_BUS } = process.env;
const { GRAYLOG_KINESIS } = process.env;
const aws_sdk_1 = __importDefault(require("aws-sdk"));
var SNS = new aws_sdk_1.default.SNS();
var messages = [];
var Kinesis = new aws_sdk_1.default.Kinesis();
var records = [];
function overrideConsoleLog() {

@@ -16,3 +16,2 @@ const origlog = console.log;

if (Object.prototype.toString.call(message) === "[object Object]" && message.type && message.type.toLowerCase() === "retterlog") {
origlog("Inside if: ");
if (!message.log) {

@@ -24,17 +23,11 @@ origlog("Received empty retterLog");

}
else if (!EVENT_BUS) {
origlog("Please specify EVENT_BUS as environment variable");
else if (!GRAYLOG_KINESIS) {
origlog("Please specify GRAYLOG_KINESIS as environment variable");
}
else {
delete message.type;
messages.push(SNS.publish({
TopicArn: EVENT_BUS,
Message: JSON.stringify({ ...message }),
MessageAttributes: {
MessageType: {
DataType: "String",
StringValue: "RetterLog"
}
}
}).promise());
records.push({
PartitionKey: Date.now().toString(),
Data: JSON.stringify({ ...message }),
});
}

@@ -44,21 +37,7 @@ }

}
async function allSettled(promises) {
await Promise.all(promises.map((promise, i) => promise
.then(value => {
console.log("fulfilled");
return {
status: "fulfilled",
value,
};
})
.catch(reason => {
console.log("rejected");
return {
status: "rejected",
reason,
};
})));
}
async function onExit() {
await allSettled(messages);
await Kinesis.putRecords({
StreamName: GRAYLOG_KINESIS,
Records: records,
}).promise();
process.exit();

@@ -65,0 +44,0 @@ }

const {EVENT_BUS} = process.env;
const {GRAYLOG_KINESIS} = process.env;
import AWS from "aws-sdk";
import { PromiseResult } from "aws-sdk/lib/request";
var SNS = new AWS.SNS()
import { PutRecordsRequestEntryList } from "aws-sdk/clients/kinesis";
var messages : Promise<PromiseResult<AWS.SNS.PublishResponse, AWS.AWSError>>[] = []
var Kinesis = new AWS.Kinesis()
var records : PutRecordsRequestEntryList = []
function overrideConsoleLog(){

@@ -14,3 +17,2 @@ const origlog = console.log;

if(Object.prototype.toString.call(message) === "[object Object]" && message.type && message.type.toLowerCase() === "retterlog"){
origlog("Inside if: ");
if(!message.log){

@@ -22,18 +24,11 @@ origlog("Received empty retterLog");

}
else if(!EVENT_BUS){
origlog("Please specify EVENT_BUS as environment variable");
else if(!GRAYLOG_KINESIS){
origlog("Please specify GRAYLOG_KINESIS as environment variable");
}
else{
delete message.type;
messages.push(
SNS.publish({
TopicArn: EVENT_BUS,
Message: JSON.stringify({...message} ),
MessageAttributes: {
MessageType: {
DataType: "String",
StringValue: "RetterLog"
}
}
}).promise()
records.push({
PartitionKey: Date.now().toString(),
Data: JSON.stringify({...message} ),
}
)

@@ -45,24 +40,7 @@ }

async function allSettled (promises: Promise<PromiseResult<AWS.SNS.PublishResponse, AWS.AWSError>>[]) {
await Promise.all(
promises.map((promise, i) =>
promise
.then(value => {
console.log("fulfilled")
return {
status: "fulfilled",
value,
}})
.catch(reason =>
{
console.log("rejected")
return {
status: "rejected",
reason,
}})
)
);
}
async function onExit(){
await allSettled(messages)
await Kinesis.putRecords({
StreamName: GRAYLOG_KINESIS!,
Records: records,
}).promise();
process.exit();

@@ -69,0 +47,0 @@ }

{
"name": "@rettersoft/retter-log",
"version": "1.1.0",
"version": "1.2.0",
"description": "Streams logs with certain format",

@@ -5,0 +5,0 @@ "main": "dist/index.js",