Socket
Socket
Sign inDemoInstall

@cardash/winston-datadog-tcp

Package Overview
Dependencies
0
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

3

index.js

@@ -18,2 +18,3 @@ const tls = require('tls')

const dd = {
createConnection,
conn: createConnection(),

@@ -34,3 +35,3 @@ }

}
if (dd.conn.destroyed) dd.conn = createConnection()
if (dd.conn.destroyed) dd.conn = dd.createConnection()
dd.conn.write(`${apiKey} ${JSON.stringify(record)}\n`, callback)

@@ -37,0 +38,0 @@ }

{
"name": "@cardash/winston-datadog-tcp",
"version": "1.0.1",
"version": "1.0.2",
"description": "A Winston-compatible (2.x) Datadog logger via TCP+SSL. No local file taking up space, no log rotation management.",

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

@@ -48,15 +48,26 @@ const hostname = require('os').hostname()

// This test will fire a rejected message at Datadog. TODO: Make `createConnection` replaceable
exports.testRestoreConn = (test) => {
test.expect(1)
test.expect(2)
const fakeConn = {
destroyed: true
destroyed: true,
write: (str, callback) => {
test.equals(str, `FAKE_KEY ${JSON.stringify({
status: 'info',
message: `Hello ${JSON.stringify(['world'])}`,
data: ['world'],
ddtags: 'env:test',
ddsource: '@cardash/winston-datadog-tcp',
hostname,
})}\n`)
callback()
}
}
const fakeCreateConnection = () => fakeConn
const logObj = winstonDatadogTcp('FAKE_KEY', { env: 'test', })
logObj.dd.conn = fakeConn
setTimeout(() => {}, 300) // Since the conn is unref'd, add some lag to let it execute
logObj.dd.createConnection = fakeCreateConnection
logObj.log('info', 'Hello', ['world'], () => {
test.equals(true, logObj.dd.conn instanceof require('tls').TLSSocket)
test.equals(fakeConn, logObj.dd.conn)
test.done()
})
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc