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

log4js-json-layout

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log4js-json-layout - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

23

lib/jsonLayout.js

@@ -5,3 +5,22 @@ /**

'use strict';
var util = require('util');
function wrapErrorsWithInspect(items) {
return items.map(function (item) {
if ((item instanceof Error) && item.stack) {
return {
inspect: function () {
return util.format(item) + '\n' + item.stack;
}
};
} else {
return item;
}
});
}
function formatLogData(logData) {
var data = Array.isArray(logData) ? logData : Array.prototype.slice.call(arguments);
return util.format.apply(util, wrapErrorsWithInspect(data));
}
function jsonLayout(config) {

@@ -20,3 +39,5 @@ function formatter(data) {

}
if (output.data) {
output.data = formatLogData(output.data);
}
if (config.include && config.include.length) {

@@ -23,0 +44,0 @@ var newOutput = {};

2

package.json
{
"name": "log4js-json-layout",
"version": "1.0.1",
"version": "1.0.2",
"description": "provides a slim and easy to use json-layout for log4js-node",

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

# log4js-json-layout
[![NPM](https://nodei.co/npm/log4js-json-layout.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/log4js-json-layouts/)
[![NPM](https://nodei.co/npm/log4js-json-layout.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/log4js-json-layout/)

@@ -16,2 +16,3 @@ provides a slim and easy to use json-layout for log4js-node (https://github.com/nomiddlename/log4js-node)

log object will contain these properties : ["startTime","categoryName","data","level"]
source param will be added to each json object if provided

@@ -28,2 +29,3 @@ ```

type: 'json',
source : 'development',
include: ['startTime', 'categoryName']

@@ -30,0 +32,0 @@ }

@@ -46,3 +46,8 @@ /**

output.should.be.deep.equal(JSON.stringify({level: expected.level, data: expected.data}));
})
});
it('should format data', function () {
data.data = ['%s', 'aaa'];
var output = layout({})(data);
JSON.parse(output).data.should.equal('aaa');
});
});

Sorry, the diff of this file is not supported yet

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