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

@aws/universal-test-runner-logger

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws/universal-test-runner-logger - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

28

dist/lib/src/index.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.makeLogger = void 0;
exports.makeLogger = exports.shouldLog = void 0;
const chalk_1 = __importDefault(require("chalk"));
const LogLevelRanks = {
debug: 10,
info: 20,
warn: 30,
error: 40,
};
function shouldLog(methodName, logLevel) {
return LogLevelRanks[methodName] >= LogLevelRanks[logLevel];
}
exports.shouldLog = shouldLog;
function prefix(fn, prefixString) {

@@ -29,10 +39,16 @@ return (...args) => {

};
let logLevel = 'info';
return {
info: prefix(methods.info, prefixString),
error: prefix(methods.error, prefixString),
warn: prefix(methods.warn, prefixString),
debug: prefix(methods.debug, prefixString),
setLogLevel: (_logLevel) => {
logLevel = _logLevel;
},
...['debug', 'info', 'warn', 'error'].reduce((loggingMethods, methodName) => ({
...loggingMethods,
[methodName]: (...args) => {
shouldLog(methodName, logLevel) && prefix(methods[methodName], prefixString)(...args);
},
}), {}),
};
}
exports.makeLogger = makeLogger;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHFFQUFxRTtBQUNyRSxzQ0FBc0M7Ozs7OztBQUV0QyxrREFBeUI7QUFXekIsU0FBUyxNQUFNLENBQUMsRUFBYyxFQUFFLFlBQW9CO0lBQ2xELE9BQU8sQ0FBQyxHQUFHLElBQUksRUFBUSxFQUFFO1FBQ3ZCLEVBQUUsQ0FB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2ROYW1lXTogKC4uLmFyZ3M6IGFueVtdKSA9PiB7XG4gICAgICAgICAgc2hvdWxkTG9nKG1ldGhvZE5hbWUsIGxvZ0xldmVsKSAmJiBwcmVmaXgobWV0aG9kc1ttZXRob2ROYW1lXSwgcHJlZml4U3RyaW5nKSguLi5hcmdzKVxuICAgICAgICB9LFxuICAgICAgfSksXG4gICAgICB7fSBhcyBMb2dnaW5nTWV0aG9kcyxcbiAgICApLFxuICB9XG59XG4iXX0=

@@ -0,9 +1,14 @@

import { LogLevel } from '@aws/universal-test-runner-types';
type LogHandler = (...args: any[]) => void;
export interface Logger {
export interface LoggingMethods {
debug: LogHandler;
info: LogHandler;
warn: LogHandler;
error: LogHandler;
debug: LogHandler;
warn: LogHandler;
}
export declare function makeLogger(prefixString: string, overrides?: Partial<Logger>): Logger;
export declare function shouldLog(methodName: keyof LoggingMethods, logLevel: LogLevel): boolean;
export interface Logger extends LoggingMethods {
setLogLevel: (level: LogLevel) => void;
}
export declare function makeLogger(prefixString: string, overrides?: Partial<LoggingMethods>): Logger;
export {};
{
"name": "@aws/universal-test-runner-logger",
"version": "0.4.0",
"version": "0.5.0",
"license": "Apache-2.0",

@@ -21,2 +21,5 @@ "main": "dist/lib/src/index.js",

},
"devDependencies": {
"@aws/universal-test-runner-types": "*"
},
"repository": {

@@ -23,0 +26,0 @@ "type": "git",

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