Socket
Socket
Sign inDemoInstall

@percy/logger

Package Overview
Dependencies
Maintainers
6
Versions
238
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.44 to 1.0.0-beta.45

48

dist/bundle.js

@@ -227,3 +227,3 @@ (function() {

this.write(level, this.format(message, debug, error ? 'error' : level, elapsed));
this.lastlog || (this.lastlog = timestamp);
this.lastlog = timestamp;
}

@@ -268,23 +268,25 @@ } // Writes a message to stdio based on the loglevel

async remote(socket, timeout = 1000) {
if (this.isRemote) return;
this.socket = socket;
let err; // if not already connected, wait until the timeout
async remote(createSocket, timeout = 1000) {
if (this.isRemote) return; // if not already connected, wait until the timeout
if (!this.isRemote) {
err = await new Promise(resolve => {
let done = event => {
clearTimeout(timeoutid);
socket.onopen = socket.onerror = null;
resolve((event === null || event === void 0 ? void 0 : event.error) || (event === null || event === void 0 ? void 0 : event.type) === 'error' && 'Error: Socket connection failed');
};
let err = await new Promise(resolve => {
let done = event => {
if (timeoutid == null) return;
timeoutid = clearTimeout(timeoutid);
if (this.socket) this.socket.onopen = this.socket.onerror = null;
resolve((event === null || event === void 0 ? void 0 : event.error) || (event === null || event === void 0 ? void 0 : event.type) === 'error' && 'Error: Socket connection failed');
};
let timeoutid = setTimeout(done, timeout, {
error: 'Error: Socket connection timed out'
});
socket.onopen = socket.onerror = done;
let timeoutid = setTimeout(done, timeout, {
error: 'Error: Socket connection timed out'
});
} // there was an error connecting, will fallback to normal logging
Promise.resolve().then(async () => {
this.socket = await createSocket();
if (this.isRemote) return done();
this.socket.onopen = this.socket.onerror = done;
}).catch(error => done({
error
}));
}); // there was an error connecting, will fallback to normal logging
if (err) {

@@ -298,3 +300,3 @@ this.log('logger', 'debug', 'Unable to connect to remote logger');

if (this.messages.size) {
socket.send(JSON.stringify({
this.socket.send(JSON.stringify({
logAll: Array.from(this.messages).map(entry => ({ ...entry,

@@ -310,3 +312,3 @@ meta: {

socket.onmessage = ({
this.socket.onmessage = ({
data

@@ -323,3 +325,3 @@ }) => {

return () => {
socket.onmessage = null;
this.socket.onmessage = null;
this.socket = null;

@@ -417,4 +419,6 @@ };

if (typeof exports === "object" && typeof module !== "undefined") {
if (typeof define === "function" && define.amd) {
define(["@percy/logger"], () => window.PercyLogger);
} else if (typeof module === "object" && module.exports) {
module.exports = window.PercyLogger;
}

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

this.write(level, this.format(message, debug, error ? 'error' : level, elapsed));
this.lastlog || (this.lastlog = timestamp);
this.lastlog = timestamp;
}

@@ -228,23 +228,25 @@ } // Writes a message to stdio based on the loglevel

async remote(socket, timeout = 1000) {
if (this.isRemote) return;
this.socket = socket;
let err; // if not already connected, wait until the timeout
async remote(createSocket, timeout = 1000) {
if (this.isRemote) return; // if not already connected, wait until the timeout
if (!this.isRemote) {
err = await new Promise(resolve => {
let done = event => {
clearTimeout(timeoutid);
socket.onopen = socket.onerror = null;
resolve((event === null || event === void 0 ? void 0 : event.error) || (event === null || event === void 0 ? void 0 : event.type) === 'error' && 'Error: Socket connection failed');
};
let err = await new Promise(resolve => {
let done = event => {
if (timeoutid == null) return;
timeoutid = clearTimeout(timeoutid);
if (this.socket) this.socket.onopen = this.socket.onerror = null;
resolve((event === null || event === void 0 ? void 0 : event.error) || (event === null || event === void 0 ? void 0 : event.type) === 'error' && 'Error: Socket connection failed');
};
let timeoutid = setTimeout(done, timeout, {
error: 'Error: Socket connection timed out'
});
socket.onopen = socket.onerror = done;
let timeoutid = setTimeout(done, timeout, {
error: 'Error: Socket connection timed out'
});
} // there was an error connecting, will fallback to normal logging
Promise.resolve().then(async () => {
this.socket = await createSocket();
if (this.isRemote) return done();
this.socket.onopen = this.socket.onerror = done;
}).catch(error => done({
error
}));
}); // there was an error connecting, will fallback to normal logging
if (err) {

@@ -258,3 +260,3 @@ this.log('logger', 'debug', 'Unable to connect to remote logger');

if (this.messages.size) {
socket.send(JSON.stringify({
this.socket.send(JSON.stringify({
logAll: Array.from(this.messages).map(entry => ({ ...entry,

@@ -270,3 +272,3 @@ meta: {

socket.onmessage = ({
this.socket.onmessage = ({
data

@@ -283,3 +285,3 @@ }) => {

return () => {
socket.onmessage = null;
this.socket.onmessage = null;
this.socket = null;

@@ -286,0 +288,0 @@ };

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

@@ -29,3 +29,3 @@ "main": "dist/index.js",

},
"gitHead": "22062e770a9b05140b7617593e93f00495888a8a"
"gitHead": "1e600c7b3318ce14aa66cb763c204443e5f034b7"
}

@@ -196,4 +196,6 @@ (function() {

if (typeof exports === "object" && typeof module !== "undefined") {
if (typeof define === "function" && define.amd) {
define(["@percy/logger"], () => window.PercyLogger.TestHelpers);
} else if (typeof module === "object" && module.exports) {
module.exports = window.PercyLogger.TestHelpers;
}
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