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

@madgex/datadog-logger

Package Overview
Dependencies
Maintainers
11
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@madgex/datadog-logger - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "@madgex/datadog-logger",
"version": "1.1.2",
"version": "1.1.3",
"description": "Setup console and Hapi Good logger",

@@ -5,0 +5,0 @@ "main": "logger_setup.js",

@@ -1,5 +0,5 @@

const assert = require('assert');
const dgram = require('dgram');
const winston = require('winston');
const { MESSAGE } = require('triple-beam');
const assert = require("assert");
const dgram = require("dgram");
const winston = require("winston");
const { MESSAGE } = require("triple-beam");

@@ -10,7 +10,4 @@ module.exports = class Transport extends winston.Transport {

{
level: 'info',
enableInternalDebugging: false,
reconnectInterval: 1000,
reconnectAttempts: 100,
bufferLength: 10000,
level: "info",
enableInternalDebugging: false
},

@@ -25,10 +22,8 @@ options

assert(this.options.host, 'Must define a host');
assert(this.options.port, 'Must supply a port');
assert(this.options.host, "Must define a host");
assert(this.options.port, "Must supply a port");
// generic transport requirements
this.name = 'winston-udp';
this.name = "winston-udp";
// initiate entry buffer
this.entryBuffer = [];
this.udpClient = null;

@@ -44,8 +39,2 @@

pushMessage(message) {
if (this.entryBuffer.length < this.options.bufferLength) {
this.entryBuffer.push(message);
}
}
getLevelNo(level) {

@@ -61,25 +50,27 @@ var levelDef = this.levels[level];

const logEntry = `${entry[MESSAGE]}\n`;
this.pushMessage(new Buffer(logEntry));
const message = new Buffer(logEntry);
if(!this.udpClient) {
this.udpClient = dgram.createSocket('udp4');
if (!this.udpClient) {
this.udpClient = dgram.createSocket("udp4");
}
while (this.udpClient && this.entryBuffer.length) {
const message = this.entryBuffer.pop();
if (message) {
this.udpClient.send(message, 0, message.length, this.options.port, this.options.host, function(err, bytes) {
if (err) {
this.close();
this.internalDebug('writing to buffer', err);
this.entryBuffer.push(bytes);
}
});
this.udpClient.send(
message,
0,
message.length,
this.options.port,
this.options.host,
function(err, bytes) {
if (err) {
this.close();
console.log("udp logging failed - log to console");
console.log(logEntry);
}
}
);
if (typeof callback === "function") {
callback(null, true);
}
}
if (typeof callback === 'function') {
callback(null, true);
}
}

@@ -92,3 +83,3 @@

close() {
if(this.udpClient) {
if (this.udpClient) {
this.udpClient.close();

@@ -95,0 +86,0 @@ this.udpClient = null;

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