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

@vladmandic/pilogger

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vladmandic/pilogger - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

3

.eslintrc.json

@@ -16,4 +16,5 @@ {

"rules": {
"no-param-reassign": "off"
"no-param-reassign": "off",
"no-restricted-syntax": "off"
}
}
{
"name": "@vladmandic/pilogger",
"version": "0.1.10",
"version": "0.1.11",
"description": "Simple Logger for NodeJS",

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

@@ -6,2 +6,3 @@ const os = require('os');

const moment = require('moment');
const { Console } = require('console');

@@ -33,2 +34,21 @@ const ctx = new chalk.Instance({ level: 2 });

};
let inspectOptions = {
showHidden: true,
depth: 5,
colors: true,
showProxy: true,
maxArrayLength: 1024,
maxStringLength: 10240,
breakLength: 200,
compact: 64,
sorted: false,
getters: true,
};
let logger = new Console({
stdout: process.stdout,
stderr: process.stderr,
ignoreErrors: true,
groupIndentation: 2,
inspectOptions,
});

@@ -45,3 +65,2 @@ function setDateFormat(dt) {

let msg = '';
// eslint-disable-next-line no-restricted-syntax
for (const message of messages) {

@@ -56,4 +75,3 @@ msg += typeof message === 'object' ? JSON.stringify(message) : message;

const time = moment(Date.now()).format(dateFormat);
// eslint-disable-next-line no-console
console.log(time, ...messages);
logger.log(time, ...messages);
}

@@ -63,3 +81,2 @@

logFile = file;
// print(tags.state, 'Application log set to', path.resolve(logFile));
logFileOK = true;

@@ -75,3 +92,2 @@ logStream = fs.createWriteStream(path.resolve(logFile), { flags: 'a' });

accessFile = file;
// print(tags.state, 'Access log set to', path.resolve(accessFile));
accessFileOK = true;

@@ -87,3 +103,2 @@ accessStream = fs.createWriteStream(path.resolve(accessFile), { flags: 'a' });

clientFile = file;
// print(tags.state, 'Client log set to', path.resolve(clientFile));
clientFileOK = true;

@@ -109,4 +124,3 @@ clientStream = fs.createWriteStream(path.resolve(clientFile), { flags: 'a' });

const time = moment(Date.now()).format(dateFormat);
// eslint-disable-next-line no-console
console.log(time, tags.timed, `${elapsed} ms`, ...messages);
logger.log(time, tags.timed, `${elapsed} ms`, ...messages);
if (logFileOK) logStream.write(`${tags.timed} ${time} ${elapsed} ms ${combineMessages(...messages)}\n`);

@@ -140,2 +154,10 @@ }

if (options.clientFile) setClientFile(options.clientFile);
if (options.inspect) inspectOptions = { ...inspectOptions, ...options.inspect };
logger = new Console({
stdout: process.stdout,
stderr: process.stderr,
ignoreErrors: true,
groupIndentation: 2,
inspectOptions,
});
}

@@ -157,2 +179,5 @@

setTimeout(() => timed(t0, 'Test function execution'), 1000);
const node = JSON.parse(fs.readFileSync('./package.json'));
// configure({ inspect: { colors: false } });
logger.log(node);
}

@@ -167,3 +192,3 @@

exports.dateFormat = setDateFormat;
// simple replacement for console.log
// simple replacement for logger.log
exports.console = print;

@@ -170,0 +195,0 @@ // log with timing

@@ -25,2 +25,3 @@ # PiLogger

If not configured, logging will be to console only and with default format
Configuring inspect options controls how object output is handled

@@ -35,2 +36,14 @@ ```js

clientFile: './client.log',
inspect: {
showHidden: true,
depth: 5,
colors: true,
showProxy: true,
maxArrayLength: 1024,
maxStringLength: 10240,
breakLength: 200,
compact: 64,
sorted: false,
getters: true,
}
}

@@ -37,0 +50,0 @@ log.configure(options);

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