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

@composer-js/core

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@composer-js/core - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

19

dist/lib/threads/ThreadWinstonTransport.js

@@ -7,10 +7,21 @@ "use strict";

const Transport = require('winston-transport');
const worker_threads_1 = require("worker_threads");
const { MESSAGE } = require('triple-beam');
/**
* Provides a Winston transport for forwarding logs from this thread to the parent's logger instance.
*
* Constructor requires two properties to be set in the `opts` argument:
* - `parentPort`
* - `threadId`
*/
class ThreadWinstonTransport extends Transport {
/**
* Creates a new instance with any defaults.
*
* @param opts The default options to initialize with. Requires two properties, `parentPort` and `threadId`, that
* must be provided from the thread worker script.
*/
constructor(opts) {
super(opts);
this.parentPort = opts.parentPort;
this.threadId = opts.threadId;
}

@@ -20,6 +31,6 @@ log(info, callback) {

// Prefix the thread ID to the message
info[MESSAGE] = `[Thread-${worker_threads_1.threadId}]: ${info[MESSAGE]}`;
info[MESSAGE] = `[Thread-${this.threadId}]: ${info[MESSAGE]}`;
// Forward the log to the parent thread
if (worker_threads_1.parentPort) {
worker_threads_1.parentPort.postMessage({
if (this.parentPort) {
this.parentPort.postMessage({
type: "winston-log",

@@ -26,0 +37,0 @@ info

declare const Transport: any;
/**
* Provides a Winston transport for forwarding logs from this thread to the parent's logger instance.
*
* Constructor requires two properties to be set in the `opts` argument:
* - `parentPort`
* - `threadId`
*/
export default class ThreadWinstonTransport extends Transport {
private parentPort;
private threadId;
/**
* Creates a new instance with any defaults.
*
* @param opts The default options to initialize with. Requires two properties, `parentPort` and `threadId`, that
* must be provided from the thread worker script.
*/
constructor(opts: any);

@@ -7,0 +19,0 @@ log(info: any, callback: Function): void;

{
"name": "@composer-js/core",
"version": "1.4.0",
"version": "1.4.1",
"description": "A collection of common utilities and core functionality for composerjs applications.",

@@ -5,0 +5,0 @@ "author": "AcceleratXR, Inc. <info@acceleratxr.com>",

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