@spotlightjs/sidecar
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -8,2 +8,3 @@ export type SidecarLogger = { | ||
export declare function activateLogger(logger: SidecarLogger): void; | ||
export declare function enableDebugLogging(debug: boolean): void; | ||
export declare const logger: { | ||
@@ -10,0 +11,0 @@ info: (message: string) => void; |
@@ -19,4 +19,8 @@ import { SidecarLogger } from './logger.js'; | ||
basePath?: string; | ||
/** | ||
* More verbose logging. | ||
*/ | ||
debug?: boolean; | ||
}; | ||
export declare function setupSidecar({ port, logger: customLogger, basePath }?: SideCarOptions): void; | ||
export declare function setupSidecar({ port, logger: customLogger, basePath, debug }?: SideCarOptions): void; | ||
export {}; |
@@ -15,8 +15,12 @@ var __defProp = Object.defineProperty; | ||
error: (message) => console.error("🔎 [Spotlight]", message), | ||
debug: (message) => console.debug("🔎 [Spotlight]", message) | ||
debug: (message) => debugEnabled && console.debug("🔎 [Spotlight]", message) | ||
}; | ||
let injectedLogger = void 0; | ||
let debugEnabled = false; | ||
function activateLogger(logger2) { | ||
injectedLogger = logger2; | ||
} | ||
function enableDebugLogging(debug) { | ||
debugEnabled = debug; | ||
} | ||
const logger = { | ||
@@ -240,3 +244,3 @@ info: (message) => (injectedLogger || defaultLogger).info(message), | ||
}; | ||
function setupSidecar({ port, logger: customLogger, basePath } = {}) { | ||
function setupSidecar({ port, logger: customLogger, basePath, debug } = {}) { | ||
let sidecarPort = DEFAULT_PORT; | ||
@@ -246,2 +250,5 @@ if (customLogger) { | ||
} | ||
if (debug || process.env.SPOTLIGHT_DEBUG) { | ||
enableDebugLogging(true); | ||
} | ||
if (port && !isValidPort(port)) { | ||
@@ -248,0 +255,0 @@ logger.info("Please provide a valid port."); |
{ | ||
"name": "@spotlightjs/sidecar", | ||
"description": "A small proxy server to capture and forward data from backend services to Spotlight.", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "type": "module", |
@@ -12,6 +12,7 @@ export type SidecarLogger = { | ||
error: (message: string) => console.error('🔎 [Spotlight]', message), | ||
debug: (message: string) => console.debug('🔎 [Spotlight]', message), | ||
debug: (message: string) => debugEnabled && console.debug('🔎 [Spotlight]', message), | ||
}; | ||
let injectedLogger: SidecarLogger | undefined = undefined; | ||
let debugEnabled = false; | ||
@@ -22,2 +23,6 @@ export function activateLogger(logger: SidecarLogger): void { | ||
export function enableDebugLogging(debug: boolean): void { | ||
debugEnabled = debug; | ||
} | ||
export const logger = { | ||
@@ -24,0 +29,0 @@ info: (message: string) => (injectedLogger || defaultLogger).info(message), |
@@ -5,3 +5,3 @@ import { createWriteStream, readFile } from 'fs'; | ||
import { createGunzip, createInflate } from 'zlib'; | ||
import { SidecarLogger, activateLogger, logger } from './logger.js'; | ||
import { SidecarLogger, activateLogger, enableDebugLogging, logger } from './logger.js'; | ||
import { MessageBuffer } from './messageBuffer.js'; | ||
@@ -32,2 +32,7 @@ | ||
basePath?: string; | ||
/** | ||
* More verbose logging. | ||
*/ | ||
debug?: boolean; | ||
}; | ||
@@ -207,3 +212,3 @@ | ||
export function setupSidecar({ port, logger: customLogger, basePath }: SideCarOptions = {}): void { | ||
export function setupSidecar({ port, logger: customLogger, basePath, debug }: SideCarOptions = {}): void { | ||
let sidecarPort = DEFAULT_PORT; | ||
@@ -215,2 +220,6 @@ | ||
if (debug || process.env.SPOTLIGHT_DEBUG) { | ||
enableDebugLogging(true); | ||
} | ||
if (port && !isValidPort(port)) { | ||
@@ -217,0 +226,0 @@ logger.info('Please provide a valid port.'); |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
21797
639
4