New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@loglin/reporter-console

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loglin/reporter-console - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

6

dist/index.d.ts

@@ -29,5 +29,7 @@ import { ReporterOptions, Reporter, Formatter, LogLevel } from 'loglin';

declare function createLabel(level: LogLevel, colors: LevelColors): string;
declare function colorStack(error: Error, level: LogLevel, colors: LevelColors): string | undefined;
declare function parseStack(stack: string): string[];
declare function formatError(error: Error, level: LogLevel, colors: LevelColors): string | undefined;
declare function formatStack(error: Error): string[] | undefined;
export { ColorCache, ColorsConfig, LevelColor, LevelColors, StackColors, basicFormatter, chalkBgColor, chalkColor, consoleReporter, createLabel, defaultColors, fancyFormatter, formatError, mergeColors, parseStack };
export { ColorCache, ColorsConfig, LevelColor, LevelColors, StackColors, basicFormatter, chalkBgColor, chalkColor, colorStack, consoleReporter, createLabel, defaultColors, fancyFormatter, formatStack, mergeColors, parseStack };

@@ -21,10 +21,23 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;

// src/stack.ts
var _path = require('path');
function parseStack(stack) {
const cwd = process.cwd() + _path.sep;
return stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
}
function formatStack(error) {
if (!error.stack)
return;
return ["\n", ...parseStack(error.stack).map((line) => " " + line)];
}
// src/formatter/basic.ts
function basicFormatter() {
return ({ level, message }) => `[${level.toUpperCase()}] ${message}`;
return ({ level, message }) => {
var _a;
const formattedMessage = message instanceof Error ? `${message.message}${((_a = formatStack(message)) == null ? void 0 : _a.join("\n")) + "\n"}` : message;
return `[${level.toUpperCase()}] ${formattedMessage}`;
};
}
// src/formatter/fancy.ts
var _path = require('path');
// src/colors.ts

@@ -133,3 +146,3 @@ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);

if (message instanceof Error) {
fancyMessage = (textColor ? chalkColor(textColor)(message.message) : message.message) + formatError(message, level, colors);
fancyMessage = (textColor ? chalkColor(textColor)(message.message) : message.message) + colorStack(message, level, colors);
} else if (textColor) {

@@ -145,11 +158,7 @@ fancyMessage = chalkColor(textColor)(message);

}
function parseStack(stack) {
const cwd = process.cwd() + _path.sep;
return stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
}
function formatError(error, level, colors) {
if (!error.stack)
function colorStack(error, level, colors) {
const stack = formatStack(error);
if (!stack)
return;
const stack = "\n\n" + parseStack(error.stack).map((line) => " " + line.replace(/^at +/, (m) => chalkColor(colors[level].stackAtColor)(m)).replace(/\((.+)\)/, (_, m) => `(${chalkColor(colors[level].stackFileColor)(m)})`)).join("\n") + "\n";
return stack;
return stack.map((line) => line.replace(/^ at +/, (m) => chalkColor(colors[level].stackAtColor)(m)).replace(/\((.+)\)/, (_, m) => `(${chalkColor(colors[level].stackFileColor)(m)})`)).join("\n") + "\n";
}

@@ -176,2 +185,3 @@

exports.basicFormatter = basicFormatter; exports.chalkBgColor = chalkBgColor; exports.chalkColor = chalkColor; exports.consoleReporter = consoleReporter; exports.createLabel = createLabel; exports.defaultColors = defaultColors; exports.fancyFormatter = fancyFormatter; exports.formatError = formatError; exports.mergeColors = mergeColors; exports.parseStack = parseStack;
exports.basicFormatter = basicFormatter; exports.chalkBgColor = chalkBgColor; exports.chalkColor = chalkColor; exports.colorStack = colorStack; exports.consoleReporter = consoleReporter; exports.createLabel = createLabel; exports.defaultColors = defaultColors; exports.fancyFormatter = fancyFormatter; exports.formatStack = formatStack; exports.mergeColors = mergeColors; exports.parseStack = parseStack;
{
"name": "@loglin/reporter-console",
"version": "1.1.6",
"version": "1.1.7",
"license": "MIT",

@@ -29,3 +29,3 @@ "author": "Marvin Rudolph",

"peerDependencies": {
"loglin": "^1.1.6"
"loglin": "^1.1.7"
},

@@ -32,0 +32,0 @@ "dependencies": {

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