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

@applitools/logger

Package Overview
Dependencies
Maintainers
34
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/logger - npm Package Compare versions

Comparing version 1.1.43 to 1.1.44

4

dist/format.js

@@ -30,4 +30,4 @@ "use strict";

exports.format = void 0;
const util_1 = require("util");
const utils = __importStar(require("@applitools/utils"));
const util_1 = require("util");
const chalk_1 = __importDefault(require("chalk"));

@@ -77,3 +77,3 @@ function format(chunks, { prelude = true, label, timestamp = new Date(), level = 'info', tags, colors } = {}) {

color = [color];
return color.reduce((chalk, color) => chalk[color] || chalk, chalk_1.default)(string);
return color.reduce((chalk, color) => { var _a; return (_a = chalk[color]) !== null && _a !== void 0 ? _a : chalk; }, chalk_1.default)(string);
}

@@ -8,14 +8,6 @@ "use strict";

const debug_1 = __importDefault(require("debug"));
const loggerMap = new Map();
const mainLogger = (0, debug_1.default)('appli');
function makeDebugHandler({ label: originalLabel } = { label: 'no-label' }) {
let logger = null;
const label = originalLabel.replace(/ /g, '-').toLowerCase();
if (loggerMap.has(label)) {
logger = loggerMap.get(label);
}
else {
logger = mainLogger.extend(label);
loggerMap.set(label, logger);
}
function makeDebugHandler({ label = 'no-label' }) {
label = label.replace(/ /g, '-').toLowerCase();
const logger = mainLogger.extend(label);
return { log };

@@ -22,0 +14,0 @@ function log(message) {

@@ -86,9 +86,7 @@ "use strict";

}
catch (ex) {
// if a file already exists ignore the error
if (!ex.message.includes('file already exists')) {
throw ex;
}
catch (err) {
if (!err.message.includes('file already exists'))
throw err;
}
}
}

@@ -51,3 +51,3 @@ "use strict";

level = log_level_1.LogLevel.all;
label = null;
label = undefined;
timestamp = false;

@@ -86,3 +86,3 @@ forceInitHandler = true;

else if (handler.type === 'debug') {
handler = (0, handler_debug_1.makeDebugHandler)(handler);
handler = (0, handler_debug_1.makeDebugHandler)({ label, ...handler });
}

@@ -104,3 +104,3 @@ else if (handler.type === 'file') {

isLogger: true,
console: (0, printer_1.makePrinter)({ handler: consoleHandler, format, prelude: false }),
console: (0, printer_1.makePrinter)({ handler: consoleHandler, format, level: log_level_1.LogLevel.all, prelude: false }),
...(0, printer_1.makePrinter)({ handler, format, label, tags, timestamp, level, colors: colors }),

@@ -113,8 +113,10 @@ tag(name, value) {

var _a, _b;
if (!(options === null || options === void 0 ? void 0 : options.colors)) {
options.colors = (_b = (_a = options === null || options === void 0 ? void 0 : options.colors) !== null && _a !== void 0 ? _a : colors) !== null && _b !== void 0 ? _b : false;
if (options) {
if (!options.colors) {
options.colors = (_b = (_a = options === null || options === void 0 ? void 0 : options.colors) !== null && _a !== void 0 ? _a : colors) !== null && _b !== void 0 ? _b : false;
}
else if (colors) {
options.colors = { ...colors, ...options === null || options === void 0 ? void 0 : options.colors };
}
}
else if (colors) {
options.colors = { ...colors, ...options === null || options === void 0 ? void 0 : options.colors };
}
return makeLogger({

@@ -121,0 +123,0 @@ format,

{
"name": "@applitools/logger",
"version": "1.1.43",
"version": "1.1.44",
"description": "Applitools logger",

@@ -50,4 +50,4 @@ "keywords": [

"scripts": {
"lint": "eslint '**/*.ts'",
"build": "tsc",
"lint": "npx eslint '**/*.ts'",
"build": "npx tsc --project ./tsconfig.build.json",
"test": "mocha --no-timeouts -r ts-node/register ./test/**/*.spec.ts",

@@ -60,9 +60,4 @@ "test:sanity": "yarn test",

},
"husky": {
"hooks": {
"pre-push": "yarn bongo lint"
}
},
"dependencies": {
"@applitools/utils": "1.3.28",
"@applitools/utils": "1.3.29",
"chalk": "4.1.2",

@@ -76,14 +71,3 @@ "debug": "4.3.3"

"@types/node": "12",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^4.3.8",
"mocha": "10.0.0",
"prettier": "^2.6.2",
"ts-node": "^10.8.0",
"typescript": "^4.7.2"
"mocha": "10.0.0"
},

@@ -90,0 +74,0 @@ "engines": {

import { type LogLevelName } from './log-level';
declare type ForegroundColor = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright';
declare type BackgroundColor = 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgGray' | 'bgGrey' | 'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright';
declare type Style = ForegroundColor | BackgroundColor;
export declare type ColoringOptions = {
type ForegroundColor = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright';
type BackgroundColor = 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgGray' | 'bgGrey' | 'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright';
type Style = ForegroundColor | BackgroundColor;
export type ColoringOptions = {
timestamp?: Style | Style[];

@@ -14,3 +14,3 @@ level?: {

};
export declare type FormatOptions = {
export type FormatOptions = {
prelude?: boolean;

@@ -17,0 +17,0 @@ label?: string;

import { type Handler } from './handler';
export declare type ConsoleHandler = {
export type ConsoleHandler = {
type: 'console';
};
export declare function makeConsoleHandler(): Handler;
import { type Handler } from './handler';
export declare type DebugHandler = {
export type DebugHandler = {
type: 'debug';
label: string;
label?: string;
};
export declare function makeDebugHandler({ label: originalLabel }?: Omit<DebugHandler, 'type'>): Handler;
export declare function makeDebugHandler({ label }: Omit<DebugHandler, 'type'>): Handler;
import { type Handler } from './handler';
export declare type FileHandler = {
export type FileHandler = {
type: 'file';

@@ -4,0 +4,0 @@ filename?: string;

import { type Handler } from './handler';
export declare type RollingFileHandler = {
export type RollingFileHandler = {
type: 'rolling file';

@@ -4,0 +4,0 @@ dirname?: string;

@@ -1,2 +0,2 @@

export declare type Handler = {
export type Handler = {
log(message: any): void;

@@ -3,0 +3,0 @@ warn?(message: any): void;

@@ -1,2 +0,2 @@

export declare type LogLevelName = keyof typeof LogLevel;
export type LogLevelName = keyof typeof LogLevel;
export declare enum LogLevel {

@@ -3,0 +3,0 @@ silent = 0,

@@ -9,3 +9,3 @@ import { type Handler } from './handler';

import { type ColoringOptions } from './format';
export declare type LoggerOptions = Omit<PrinterOptions, 'handler' | 'level' | 'colors'> & {
export type LoggerOptions = Omit<Partial<PrinterOptions>, 'handler' | 'level' | 'colors'> & {
handler?: ConsoleHandler | FileHandler | RollingFileHandler | DebugHandler | Handler;

@@ -16,3 +16,3 @@ level?: LogLevelName | number;

};
export declare type ExtendOptions = Omit<LoggerOptions, 'handler'>;
export type ExtendOptions = Omit<LoggerOptions, 'handler'>;
export interface Logger extends Printer {

@@ -19,0 +19,0 @@ isLogger: true;

import { type Handler } from './handler';
import { type ColoringOptions } from './format';
import { format } from './format';
export declare type PrinterOptions = {
handler?: Handler;
format?: typeof format;
export type PrinterOptions = {
handler: Handler;
format: typeof format;
prelude?: boolean;

@@ -11,3 +11,3 @@ label?: string;

timestamp?: boolean;
level?: number;
level: number;
colors?: ColoringOptions;

@@ -14,0 +14,0 @@ };

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