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

@percy/logger

Package Overview
Dependencies
Maintainers
6
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/logger - npm Package Compare versions

Comparing version 1.0.0-beta.8 to 1.0.0-beta.9

26

index.js

@@ -32,3 +32,3 @@ const os = require('os');

new transports.Console({
level: 'error',
level: process.env.PERCY_LOGLEVEL || 'info',
stderrLevels: ['error'],

@@ -70,14 +70,16 @@ format: format.combine(

// Patch the error method to handle error objects. Winston accepts objects with
// messages and meta as an argument but will fail to log real error instances.
logger.error = function(message) {
// libraries may also throw errors which are not technically Error instances
if (typeof message === 'object') {
// get the stack trace for debug (no ternary to always fallback to string)
message = (this.loglevel() === 'debug' && message.stack) || message.toString();
}
// Patch the error and debug methods to handle error objects. Winston accepts objects
// with messages and meta as an argument but will fail to log real error instances.
for (let method of ['error', 'debug']) {
logger[method] = function(message) {
// libraries may also throw errors which are not technically Error instances
if (typeof message === 'object') {
// get the stack trace for debug (no ternary to always fallback to string)
message = (this.loglevel() === 'debug' && message.stack) || message.toString();
}
// return super.error(message)
return this.constructor.prototype.error.call(this, message);
};
// return super[method](message)
return this.constructor.prototype[method].call(this, message);
};
}

@@ -84,0 +86,0 @@ // Patch the query method to return a promise, query the file transport only,

{
"name": "@percy/logger",
"version": "1.0.0-beta.8",
"version": "1.0.0-beta.9",
"license": "MIT",

@@ -24,3 +24,3 @@ "main": "index.js",

},
"gitHead": "6015850e7c20c130d625fcb327b10d7513b35707"
"gitHead": "57a2eeb90c7f5cdf8827c78be1e5c12df581f4b5"
}

@@ -101,2 +101,10 @@ import fs from 'fs';

describe('#debug()', () => {
it('is patched to log error instance strings', () => {
let err = { toString: () => 'error' };
stdio.capture(() => log.debug(err));
expect(stdio[1]).toEqual(['[percy] error\n']);
});
});
describe('#query()', () => {

@@ -103,0 +111,0 @@ beforeEach(() => {

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