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

btrz-logger

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-logger - npm Package Compare versions

Comparing version 2.5.1 to 2.5.2

2

package.json
{
"name": "btrz-logger",
"version": "2.5.1",
"version": "2.5.2",
"description": "A multi-transport logger",

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

@@ -0,6 +1,18 @@

"use strict";
const assert = require("assert");
const _ = require("lodash");
const logentries = require("node-logentries");
const logCleaner = require("./log-cleaner");
// We memoize the function that creates connections to Logentries so that we only create one connection to Logentries for each unique
// api token
const cacheKeyResolver = (options) => {
return options.token;
};
const createLogEntriesLogger = _.memoize((...args) => {
return logentries.logger(...args);
}, cacheKeyResolver);
function stringifyTokens(tokens) {

@@ -22,3 +34,3 @@ return {

options.levels = {access: 0, debug: 1, info: 2, error: 3, fatal: 4};
this.logger = logentries.logger(options);
this.logger = createLogEntriesLogger(options);
}

@@ -25,0 +37,0 @@

@@ -22,3 +22,21 @@ const {expect} = require("chai");

});
it("should re-use existing connections to LogEntries when an existing connection was created for the same api token", () => {
const logEntriesLoggerSpy = sandbox.spy(logentries, "logger");
let logEntriesLogger = new LogEntriesLogger({token: "A"});
expect(logEntriesLoggerSpy.callCount).to.eql(1);
expect(logEntriesLogger.logger).to.eql(logEntriesLoggerSpy.getCall(0).returnValue);
// Create another instance with the same logentries token. We expect the logentries logger from the first instance to be re-used.
logEntriesLogger = new LogEntriesLogger({token: "A"});
expect(logEntriesLoggerSpy.callCount).to.eql(1);
expect(logEntriesLogger.logger).to.eql(logEntriesLoggerSpy.getCall(0).returnValue);
// Create another instance with a different logentries token. We expect a new logentries logger to be created.
logEntriesLogger = new LogEntriesLogger({token: "B"});
expect(logEntriesLoggerSpy.callCount).to.eql(2);
expect(logEntriesLogger.logger).to.eql(logEntriesLoggerSpy.getCall(1).returnValue);
});
});
});
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