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

@dotcom-tool-kit/logger

Package Overview
Dependencies
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcom-tool-kit/logger - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

19

lib/helpers.js

@@ -15,2 +15,6 @@ "use strict";

const endRegex = new RegExp(`(?:(?:${ansiRegexText})|\s|\n)+$`);
// RIS escape code to effectively do a clear (^L) on the terminal. TypeScript's
// watch mode does this and it's annoying to have the logs shunted around when
// tracking multiple tasks.
const ansiReset = /\x1Bc/g;
// Trim whitespace whilst preserving ANSI escape codes

@@ -34,2 +38,13 @@ function ansiTrim(message) {

}
// Remove ANSI escape codes that mess with the terminal state. This selectively
// only deletes escape codes we've seen causing issues so that other
// functionality (particularly colouring) passes through fine.
function stripAnsiReset(message) {
return message.replace(ansiReset, '');
}
// Collection of functions to make the hooked logs more readable, especially
// when multiple tasks are running in a Tool Kit hook
function cleanupLogs(message) {
return stripAnsiReset(ansiTrim(message));
}
// This function hooks winston into console.log statements. Most useful for when

@@ -55,3 +70,3 @@ // calling functions from external libraries that you expect will do their own

}
logger.log(level, ansiTrim(message), { process: processName, writeCallback });
logger.log(level, cleanupLogs(message), { process: processName, writeCallback });
return true;

@@ -91,3 +106,3 @@ }

// consume
callback(null, { level, message });
callback(null, { level, message: cleanupLogs(message) });
}

@@ -94,0 +109,0 @@ }))

@@ -15,2 +15,3 @@ import colours from 'ansi-colors';

title: colours.StyleFunction;
taskHeader: colours.StyleFunction;
errorHighlight: colours.StyleFunction;

@@ -17,0 +18,0 @@ error: (string: string) => string;

@@ -21,2 +21,3 @@ "use strict";

title: ansi_colors_1.default.bold.underline,
taskHeader: ansi_colors_1.default.bgWhite.black,
errorHighlight: ansi_colors_1.default.red,

@@ -23,0 +24,0 @@ error: (string) => `${exports.styles.errorHighlight.bold('‼︎')} ${exports.styles.title(string)}`,

2

package.json
{
"name": "@dotcom-tool-kit/logger",
"version": "3.2.0",
"version": "3.3.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib",

Sorry, the diff of this file is not supported yet

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