Socket
Socket
Sign inDemoInstall

@cardash/winston-datadog-tcp

Package Overview
Dependencies
14
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

7

2.x/index.js
const tls = require('tls')
const hostname = require('os').hostname()
const safeStringify = require('fast-safe-stringify')

@@ -29,3 +30,3 @@ const createConnection = () => {

status: loglevel,
message: `${text} ${JSON.stringify(data)}`,
message: `${text} ${safeStringify(data)}`,
data,

@@ -40,3 +41,3 @@ ddtags,

if (dd.queuedMessage) return dd.conn.write(dd.queuedMessage, () => {
dd.queuedMessage = `${apiKey} ${JSON.stringify(record)}\n`
dd.queuedMessage = `${apiKey} ${safeStringify(record)}\n`
dd.conn.write(dd.queuedMessage, () => {

@@ -48,3 +49,3 @@ dd.queuedMessage = undefined

}
dd.queuedMessage = `${apiKey} ${JSON.stringify(record)}\n`
dd.queuedMessage = `${apiKey} ${safeStringify(record)}\n`
dd.conn.write(dd.queuedMessage, () => {

@@ -51,0 +52,0 @@ dd.queuedMessage = undefined

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

@@ -35,4 +35,5 @@ "main": "index.js",

"dependencies": {
"fast-safe-stringify": "^2.0.6",
"winston-transport": "^4.3.0"
}
}

@@ -122,1 +122,29 @@ const hostname = require('os').hostname()

}
exports.testCircularLogging = (test) => {
test.expect(1)
const fakeConn = {
write: (str, cb) => {
test.equals(str, `FAKE_KEY ${JSON.stringify({
status: 'info',
message: 'Hello {"a":1,"o":"[Circular]"}',
data: {
a: 1,
o: '[Circular]'
},
ddtags: 'env:test',
ddsource: '@cardash/winston-datadog-tcp',
hostname,
})}\n`)
cb()
},
}
const logObj = winstonDatadogTcp('FAKE_KEY', { env: 'test', })
logObj.dd.conn = fakeConn
const data = {
a: 1,
}
data.o = data
logObj.log('info', 'Hello', data, () => 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