Socket
Socket
Sign inDemoInstall

logd-console-output

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logd-console-output - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "logd-console-output",
"version": "1.0.0",
"version": "1.0.1",
"description": "console output for logd",

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

@@ -92,2 +92,3 @@ 'use strict';

color,
options,
});

@@ -94,0 +95,0 @@

@@ -93,2 +93,3 @@ 'use strict';

label,
options,
}) {

@@ -109,2 +110,3 @@ if (callsite) {

color,
options,
});

@@ -132,2 +134,3 @@

label,
options = {},
}) {

@@ -159,2 +162,3 @@ // make sure no objects is rendered twice

color,
options,
});

@@ -161,0 +165,0 @@ } else {

@@ -26,11 +26,15 @@ 'use strict';

context.renderDecoration({label, decoration: `[Array] (${value.length}): [`});
context.in();
value.forEach((value, index) => {
if (value.length) {
context.in();
value.forEach((value, index) => {
context.newLine();
context.renderValue({value, decoration: `${index}`});
});
context.out();
context.newLine();
context.renderValue({value, decoration: `${index}`});
});
context.out();
context.newLine();
}
context.renderDecoration({decoration: `]`});
}
}

@@ -27,4 +27,4 @@ 'use strict';

context.renderDecoration({label, decoration: (decoration ? decoration+' ' : '')+`[Buffer] (${value.length} bytes)`, close: true});
context.print(this.decorate(context, this.truncate('0x'+value.slice(0, 50).toString('HEX'), 80), 'text', color));
context.print(this.decorate(context, this.truncate('0x'+value.slice(0, 80).toString('HEX'), 80), 'text', color));
}
}

@@ -28,3 +28,3 @@ 'use strict';

context.print(this.decorate(context, this.pad(this.truncateLeft(this.truncatePath(value.fileName)), 31, ' '), 'path'));
context.print(this.decorate(context, `:${value.lineNumber}, `, 'line'));
context.print(this.decorate(context, `:${this.padRight(value.lineNumber)} `, 'line'));
context.print(this.decorate(context, this.pad(this.truncateLeft(this.getSignature(value), 25), 25, ' '), 'signature'));

@@ -47,4 +47,11 @@ }

padRight(input, len = 5, char = ' ') {
input = input+'';
if (input.length < len) return input+char.repeat(len-input.length);
else return input;
}
pad(input, len = 2, char = '0') {

@@ -51,0 +58,0 @@ input = input+'';

@@ -70,4 +70,10 @@ 'use strict';

const frames = this.convertStack(value);
const structuredFrames = this.analyzeFrames(frames);
let structuredFrames = this.analyzeFrames(frames);
// remove the first frame if it contains the error message
if (structuredFrames.length && structuredFrames[0].text && structuredFrames[0].text.includes(value.message)) {
structuredFrames = structuredFrames.slice(1);
}

@@ -74,0 +80,0 @@ // print the frames

@@ -27,16 +27,18 @@ 'use strict';

context.renderDecoration({label, decoration: `${decoration ? decoration+' ' : ''}[Map] (${value.size}): {`});
context.in();
for (const [key, item] of value.entries()) {
if (value.size) {
context.in();
for (const [key, item] of value.entries()) {
context.newLine();
context.renderValue({
value: item,
label: key,
});
}
context.out();
context.newLine();
context.renderValue({
value: item,
label: key,
});
}
context.out();
context.newLine();
context.renderDecoration({decoration: `}`});
}
}

@@ -27,16 +27,19 @@ 'use strict';

const keys = Object.keys(value);
context.renderDecoration({label, decoration: `${decoration ? decoration+' ' : ''}[Object] (${keys.length}): {`});
context.renderDecoration({label, decoration: `${decoration ? decoration+' ' : ''}[Object] (${keys.length}): {`});
context.in();
keys.forEach((key, index) => {
if (keys.length) {
context.in();
keys.forEach((key, index) => {
context.newLine();
context.renderValue({
value: value[key],
label: key,
});
});
context.out();
context.newLine();
context.renderValue({
value: value[key],
label: key,
});
});
context.out();
context.newLine();
}
context.renderDecoration({decoration: `}`});
}
}

@@ -33,3 +33,3 @@ 'use strict';

return input.substr(input.length-len+truncateString.length)+truncateString;
return input.substr(0, input.length-len+truncateString.length)+truncateString;
} else return input;

@@ -36,0 +36,0 @@ }

@@ -26,18 +26,22 @@ 'use strict';

context.renderDecoration({label, decoration: `[Set] (${value.size}): [`});
context.in();
let index = 0;
for (const item of value.values()) {
if (value.size) {
context.in();
let index = 0;
for (const item of value.values()) {
context.newLine();
context.renderValue({
value: item,
decoration: `${index}`
});
index++;
}
context.out();
context.newLine();
context.renderValue({
value: item,
decoration: `${index}`
});
index++;
}
context.out();
context.newLine();
context.renderDecoration({decoration: `]`});
}
}

@@ -25,6 +25,7 @@ 'use strict';

color,
options,
}) {
context.renderDecoration({label, decoration: (decoration ? decoration+' ' : '')+`(${value.length})`, close: true});
context.print(this.decorate(context, this.truncate(value.slice(0, 80), 80), 'text', color));
context.print(this.decorate(context, this.truncate(value, options.truncate || 80), 'text', color));
}
}

@@ -117,3 +117,3 @@ 'use strict';

await validator.validate([Buffer.alloc(100, 'a')], ['\u001b[90m[Buffer] (100 bytes)\u001b[39m\u001b[90m: \u001b[39m\u001b[37m1616161616161616161616161616161616161616161616161616161616161616161616161616161…\u001b[39m']);
await validator.validate([Buffer.alloc(100, 'a')], ['\u001b[90m[Buffer] (100 bytes)\u001b[39m\u001b[90m: \u001b[39m\u001b[37m0x616161616161616161616161616161616161616161616161616161616161616161616161616161616…\u001b[39m']);
});

@@ -120,0 +120,0 @@

@@ -41,3 +41,3 @@ 'use strict';

await validator.validate([1], [
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white('…y/long/path/to/be/Truncated.js'))}${chalk.grey(':3425, ')}${chalk.dim(chalk.white('…t.section.test (as cb): '))}${chalk.blue(1)}`,
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white('…y/long/path/to/be/Truncated.js'))}${chalk.grey(':3425 ')}${chalk.dim(chalk.white('…t.section.test (as cb): '))}${chalk.blue(1)}`,
], {callsite});

@@ -63,3 +63,3 @@ });

await validator.validate([1], [
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white(' test/ns.js'))}${chalk.grey(':3425, ')}${chalk.dim(chalk.white(' o.s: '))}${chalk.blue(1)}`,
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white(' test/ns.js'))}${chalk.grey(':3425 ')}${chalk.dim(chalk.white(' o.s: '))}${chalk.blue(1)}`,
], {callsite});

@@ -83,5 +83,5 @@ });

await validator.validate([1], [
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white(' test/ns.js'))}${chalk.grey(':3425, ')}${chalk.dim(chalk.white(' o: '))}${chalk.blue(1)}`,
`${chalk.grey('01 01:00:00.000 > ')}${chalk.dim(chalk.white(' test/ns.js'))}${chalk.grey(':3425 ')}${chalk.dim(chalk.white(' o: '))}${chalk.blue(1)}`,
], {callsite});
});
});

@@ -102,3 +102,3 @@ 'use strict';

color: 'green.bold',
callsite,
callsite: Object.assign({}, callsite, {lineNumber: 4}),
});

@@ -119,2 +119,17 @@ log.log({

callsite,
});
log.log({
values: [`a pretty long string that should be trunctaed, but does it? I'm not sure, or am i? i am! So, i'm still in the airplane and someone keep sfarting. Thanks obama!`],
color: 'red.bold',
callsite,
});
log.log({
values: [`a pretty long string that should be trunctaed, but does it? I'm not sure, or am i? i am! So, i'm still in the airplane and someone keep sfarting. Thanks obama! this one gets rendered!`],
color: 'cyan.bold.strikethrough.underline.bgBlue',
callsite,
options: {
truncate: 1000
}
});
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