Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hmcts/nodejs-logging

Package Overview
Dependencies
Maintainers
11
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hmcts/nodejs-logging - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

17

log/Logger.js

@@ -6,4 +6,2 @@ const _ = require('lodash');

let singleton = Symbol();
let singletonEnforcer = Symbol();
let userConfig = {};

@@ -17,6 +15,3 @@

constructor(enforcer) {
if (enforcer != singletonEnforcer) {
throw new Error('Cannot construct Logger singleton, use the static getLogger() function');
}
constructor() {
}

@@ -65,9 +60,7 @@

static getLogger(name) {
if (!this[singleton]) {
this[singleton] = new Logger(singletonEnforcer);
}
this[singleton].logger = logging.log4js.getLogger(name);
this[singleton].logger.setLevel(logging.currentLevel);
const logger = new Logger();
logger.logger = logging.log4js.getLogger(name);
logger.logger.setLevel(logging.currentLevel);
return this[singleton];
return logger;
}

@@ -74,0 +67,0 @@

{
"name": "@hmcts/nodejs-logging",
"version": "1.1.2",
"version": "1.2.0",
"description": "",

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

@@ -285,16 +285,10 @@ 'use strict'

it('should only create a single instance', () => {
expect(loggerInstance1).to.deep.equal(loggerInstance2);
expect(loggerInstance2).to.deep.equal(loggerInstance3);
expect(loggerInstance3).to.deep.equal(loggerInstance1);
it('should create multiple instances', () => {
expect(loggerInstance1).to.not.equal(loggerInstance2);
expect(loggerInstance2).to.not.equal(loggerInstance3);
expect(loggerInstance3).to.not.equal(loggerInstance1);
});
it('should throw an Error', () => {
expect(() => {
new Logger();
}).to.throw(Error, 'Cannot construct Logger singleton, use the static getLogger() function');
});
});
});
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