From fb51197edc67c1e9e24c46f47256c3eed7ca9d28 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 14:28:41 +0400 Subject: [PATCH 1/8] increase debug logging --- src/control/LiveInstrumentRemote.ts | 8 ++++++++ test/TestUtils.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/control/LiveInstrumentRemote.ts b/src/control/LiveInstrumentRemote.ts index d73577f..26a254b 100644 --- a/src/control/LiveInstrumentRemote.ts +++ b/src/control/LiveInstrumentRemote.ts @@ -9,6 +9,8 @@ import EventBus from "@vertx/eventbus-bridge-client.js"; import LiveInstrumentCommand from "../model/command/LiveInstrumentCommand"; import CommandType from "../model/command/CommandType"; import VariableUtil from "../util/VariableUtil"; +import SourcePlusPlus from "../SourcePlusPlus"; +import debugLog = SourcePlusPlus.debugLog; export interface VariableInfo { block: Runtime.PropertyDescriptor[] @@ -221,6 +223,7 @@ export default class LiveInstrumentRemote { } private async setBreakpoint(scriptId: string, line: number): Promise { + debugLog(`Setting breakpoint at ${scriptId}:${line}`); if (this.pendingBreakpoints.has(scriptId + ':' + line)) { return this.pendingBreakpoints.get(scriptId + ':' + line); } @@ -253,6 +256,7 @@ export default class LiveInstrumentRemote { } async addInstrument(instrument: LiveInstrument): Promise { + debugLog(`Adding instrument: ${instrument.id}`); if (this.instruments.get(instrument.id) || this.instrumentCache.get(instrument.id)) { return; // Instrument already exists or is in the cache } @@ -287,6 +291,7 @@ export default class LiveInstrumentRemote { } removeInstrument(instrumentId: string) { + debugLog("Removing instrument: " + instrumentId); let instrument = this.instruments.get(instrumentId); if (!instrument) { @@ -323,6 +328,7 @@ export default class LiveInstrumentRemote { } handleInstrumentCommand(command: LiveInstrumentCommand) { + debugLog("Received instrument command: " + command); if (command.commandType === CommandType.ADD_LIVE_INSTRUMENT) { command.instruments.forEach(this.addInstrument.bind(this)); } else if (command.commandType === CommandType.REMOVE_LIVE_INSTRUMENT) { @@ -338,6 +344,7 @@ export default class LiveInstrumentRemote { } handleConditionalFailed(instrument: LiveInstrument, error: string) { + debugLog("Conditional failed for instrument: " + instrument.id + " - " + error); this.removeInstrument(instrument.id); this.eventBus.publish("spp.processor.status.live-instrument-removed", { occurredAt: Date.now(), @@ -349,6 +356,7 @@ export default class LiveInstrumentRemote { // TODO: Call this regularly to clean up old instruments // TODO: Ensure the cache doesn't get too large private cleanCache() { + debugLog("Cleaning cache"); let now = Date.now(); this.instrumentCache.forEach((value, key) => { if (now - value.timeCached > 1000 * 60 * 60) { diff --git a/test/TestUtils.js b/test/TestUtils.js index a91c526..54631ea 100644 --- a/test/TestUtils.js +++ b/test/TestUtils.js @@ -17,7 +17,7 @@ class TestUtils { static async setupProbe() { this.timeout(15000); - await SourcePlusPlus.start().then(function () { + await SourcePlusPlus.start(null, true).then(function () { console.log("SourcePlusPlus started"); }).catch(function (err) { assert.fail(err); From a09632f72a5b201e62e5be2a0b9cf858b868b3a6 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 16:59:41 +0400 Subject: [PATCH 2/8] increase debug logging --- src/control/LiveInstrumentRemote.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/control/LiveInstrumentRemote.ts b/src/control/LiveInstrumentRemote.ts index 26a254b..4e0901b 100644 --- a/src/control/LiveInstrumentRemote.ts +++ b/src/control/LiveInstrumentRemote.ts @@ -9,8 +9,6 @@ import EventBus from "@vertx/eventbus-bridge-client.js"; import LiveInstrumentCommand from "../model/command/LiveInstrumentCommand"; import CommandType from "../model/command/CommandType"; import VariableUtil from "../util/VariableUtil"; -import SourcePlusPlus from "../SourcePlusPlus"; -import debugLog = SourcePlusPlus.debugLog; export interface VariableInfo { block: Runtime.PropertyDescriptor[] @@ -23,6 +21,12 @@ interface CachedInstrument { timeCached: number } +function debugLog(...args: any[]) { + if (true) { //todo: debug + console.log(...args); + } +} + export default class LiveInstrumentRemote { instruments: Map = new Map(); session: inspector.Session; From ffba2b2e6077169a2ffc53e1eb0c277504daba2e Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:04:53 +0400 Subject: [PATCH 3/8] increase debug logging --- src/SourcePlusPlus.ts | 2 ++ src/control/LiveInstrumentRemote.ts | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SourcePlusPlus.ts b/src/SourcePlusPlus.ts index baefe38..217cd20 100644 --- a/src/SourcePlusPlus.ts +++ b/src/SourcePlusPlus.ts @@ -158,10 +158,12 @@ namespace SourcePlusPlus { function registerRemotes(eventBus: EventBus) { eventBus.registerHandler("spp.probe.command.live-instrument-remote", {}, (err, message) => { + debugLog("Received instrument command: " + message.body); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); eventBus.registerHandler(`spp.probe.command.live-instrument-remote:${probeConfig.spp.probe_id}`, {}, (err, message) => { + debugLog("Received instrument command: " + message.body); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); diff --git a/src/control/LiveInstrumentRemote.ts b/src/control/LiveInstrumentRemote.ts index 4e0901b..2ef139e 100644 --- a/src/control/LiveInstrumentRemote.ts +++ b/src/control/LiveInstrumentRemote.ts @@ -332,7 +332,6 @@ export default class LiveInstrumentRemote { } handleInstrumentCommand(command: LiveInstrumentCommand) { - debugLog("Received instrument command: " + command); if (command.commandType === CommandType.ADD_LIVE_INSTRUMENT) { command.instruments.forEach(this.addInstrument.bind(this)); } else if (command.commandType === CommandType.REMOVE_LIVE_INSTRUMENT) { From 16c64bd3259812ef603171abef5f58b5f99947a1 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:10:08 +0400 Subject: [PATCH 4/8] increase debug logging --- src/SourcePlusPlus.ts | 4 ++-- src/control/ContextReceiver.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SourcePlusPlus.ts b/src/SourcePlusPlus.ts index 217cd20..63ddc92 100644 --- a/src/SourcePlusPlus.ts +++ b/src/SourcePlusPlus.ts @@ -158,12 +158,12 @@ namespace SourcePlusPlus { function registerRemotes(eventBus: EventBus) { eventBus.registerHandler("spp.probe.command.live-instrument-remote", {}, (err, message) => { - debugLog("Received instrument command: " + message.body); + debugLog("Received probe-wide instrument command: " + message.body); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); eventBus.registerHandler(`spp.probe.command.live-instrument-remote:${probeConfig.spp.probe_id}`, {}, (err, message) => { - debugLog("Received instrument command: " + message.body); + debugLog("Received probe-specific instrument command: " + message.body); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); diff --git a/src/control/ContextReceiver.ts b/src/control/ContextReceiver.ts index f365826..8d7fc4e 100644 --- a/src/control/ContextReceiver.ts +++ b/src/control/ContextReceiver.ts @@ -1,4 +1,3 @@ -// import LiveInstrumentRemote from "./LiveInstrumentRemote"; import {LogData, LogDataBody, LogTags, TextLog, TraceContext} from "skywalking-backend-js/lib/proto/logging/Logging_pb"; import {KeyStringValuePair} from "skywalking-backend-js/lib/proto/common/Common_pb"; import {ContextManager} from "skywalking-backend-js"; @@ -9,6 +8,12 @@ import {Debugger} from "inspector"; import VariableUtil from "../util/VariableUtil"; import ProbeMemory from "../ProbeMemory"; +function debugLog(...args: any[]) { + if (true) { //todo: debug + console.log(...args); + } +} + namespace ContextReceiver { let logReport; @@ -50,6 +55,7 @@ namespace ContextReceiver { export function applyBreakpoint(breakpointId: string, source: string | undefined, line: number, frames: Debugger.CallFrame[], variables) { + debugLog(`applyBreakpoint: ${breakpointId} ${source} ${line}`); let activeSpan = ContextManager.current.newLocalSpan(callFrameToString(frames[0])); activeSpan.start(); @@ -94,6 +100,7 @@ namespace ContextReceiver { } export function applyLog(liveLogId: string, logFormat: string, logArguments: any) { + debugLog(`applyLog: ${liveLogId} ${logFormat} ${logArguments}`); let logTags = new LogTags(); logTags.addData(new KeyStringValuePair().setKey('log_id').setValue(liveLogId)); logTags.addData(new KeyStringValuePair().setKey('level').setValue('Live')); From e578f8259681e5cec750b63a0563361188a17986 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:12:37 +0400 Subject: [PATCH 5/8] increase debug logging --- src/util/SourceMapper.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/util/SourceMapper.ts b/src/util/SourceMapper.ts index c9c508f..96e3e5d 100644 --- a/src/util/SourceMapper.ts +++ b/src/util/SourceMapper.ts @@ -4,6 +4,12 @@ import * as fs from "fs"; import LiveSourceLocation from "../model/LiveSourceLocation"; import * as vlq from 'vlq'; +function debugLog(...args: any[]) { + if (true) { //todo: debug + console.log(...args); + } +} + export default class SourceMapper { scriptLoaded: (sourceLocation: string, scriptId: string) => void; mapped: Map @@ -15,6 +21,7 @@ export default class SourceMapper { } map(scriptId: string, fileUrl: string, sourcemapFile?: string) { + debugLog("SourceMapper.map", scriptId, fileUrl, sourcemapFile); let basePath = process.cwd(); let filePath = decodeURIComponent(url.parse(fileUrl).path); if (!filePath) { @@ -56,7 +63,11 @@ export default class SourceMapper { mapLocation(location: LiveSourceLocation): MappedLocation { let mappedFile: MappedFile = this.mapped.get(location.source); - if (!mappedFile) return undefined; + if (!mappedFile) { + debugLog("SourceMapper.mapLocation", "No mapped file found for", location.source); + return undefined; + } + debugLog("SourceMapper.mapLocation", "Mapped file found for", location.source); return { scriptId: mappedFile.scriptId, From 3cfec19a273cc5824e78e541e1aa0948c8d906bf Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:17:06 +0400 Subject: [PATCH 6/8] decrease debug logging --- src/util/SourceMapper.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/SourceMapper.ts b/src/util/SourceMapper.ts index 96e3e5d..dc5ebdf 100644 --- a/src/util/SourceMapper.ts +++ b/src/util/SourceMapper.ts @@ -21,7 +21,6 @@ export default class SourceMapper { } map(scriptId: string, fileUrl: string, sourcemapFile?: string) { - debugLog("SourceMapper.map", scriptId, fileUrl, sourcemapFile); let basePath = process.cwd(); let filePath = decodeURIComponent(url.parse(fileUrl).path); if (!filePath) { From 53db212af4ea25164ac4f86d2b38586c273f14db Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:28:05 +0400 Subject: [PATCH 7/8] debug logging --- src/SourcePlusPlus.ts | 4 ++-- src/control/ContextReceiver.ts | 11 +++-------- src/control/LiveInstrumentRemote.ts | 17 ++++++----------- src/util/SourceMapper.ts | 11 +++-------- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/SourcePlusPlus.ts b/src/SourcePlusPlus.ts index 63ddc92..876d532 100644 --- a/src/SourcePlusPlus.ts +++ b/src/SourcePlusPlus.ts @@ -158,12 +158,12 @@ namespace SourcePlusPlus { function registerRemotes(eventBus: EventBus) { eventBus.registerHandler("spp.probe.command.live-instrument-remote", {}, (err, message) => { - debugLog("Received probe-wide instrument command: " + message.body); + debugLog("Received probe-wide instrument command: " + JSON.stringify(message.body)); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); eventBus.registerHandler(`spp.probe.command.live-instrument-remote:${probeConfig.spp.probe_id}`, {}, (err, message) => { - debugLog("Received probe-specific instrument command: " + message.body); + debugLog("Received probe-specific instrument command: " + JSON.stringify(message.body)); liveInstrumentRemote.handleInstrumentCommand( LiveInstrumentCommand.fromJson(message.body)); }); diff --git a/src/control/ContextReceiver.ts b/src/control/ContextReceiver.ts index 8d7fc4e..210856c 100644 --- a/src/control/ContextReceiver.ts +++ b/src/control/ContextReceiver.ts @@ -7,12 +7,7 @@ import {LogReportServiceClient} from "skywalking-backend-js/lib/proto/logging/Lo import {Debugger} from "inspector"; import VariableUtil from "../util/VariableUtil"; import ProbeMemory from "../ProbeMemory"; - -function debugLog(...args: any[]) { - if (true) { //todo: debug - console.log(...args); - } -} +import SourcePlusPlus from "../SourcePlusPlus"; namespace ContextReceiver { let logReport; @@ -55,7 +50,7 @@ namespace ContextReceiver { export function applyBreakpoint(breakpointId: string, source: string | undefined, line: number, frames: Debugger.CallFrame[], variables) { - debugLog(`applyBreakpoint: ${breakpointId} ${source} ${line}`); + SourcePlusPlus.debugLog(`applyBreakpoint: ${breakpointId} ${source} ${line}`); let activeSpan = ContextManager.current.newLocalSpan(callFrameToString(frames[0])); activeSpan.start(); @@ -100,7 +95,7 @@ namespace ContextReceiver { } export function applyLog(liveLogId: string, logFormat: string, logArguments: any) { - debugLog(`applyLog: ${liveLogId} ${logFormat} ${logArguments}`); + SourcePlusPlus.debugLog(`applyLog: ${liveLogId} ${logFormat} ${logArguments}`); let logTags = new LogTags(); logTags.addData(new KeyStringValuePair().setKey('log_id').setValue(liveLogId)); logTags.addData(new KeyStringValuePair().setKey('level').setValue('Live')); diff --git a/src/control/LiveInstrumentRemote.ts b/src/control/LiveInstrumentRemote.ts index 2ef139e..5fc941a 100644 --- a/src/control/LiveInstrumentRemote.ts +++ b/src/control/LiveInstrumentRemote.ts @@ -9,6 +9,7 @@ import EventBus from "@vertx/eventbus-bridge-client.js"; import LiveInstrumentCommand from "../model/command/LiveInstrumentCommand"; import CommandType from "../model/command/CommandType"; import VariableUtil from "../util/VariableUtil"; +import SourcePlusPlus from "../SourcePlusPlus"; export interface VariableInfo { block: Runtime.PropertyDescriptor[] @@ -21,12 +22,6 @@ interface CachedInstrument { timeCached: number } -function debugLog(...args: any[]) { - if (true) { //todo: debug - console.log(...args); - } -} - export default class LiveInstrumentRemote { instruments: Map = new Map(); session: inspector.Session; @@ -227,7 +222,7 @@ export default class LiveInstrumentRemote { } private async setBreakpoint(scriptId: string, line: number): Promise { - debugLog(`Setting breakpoint at ${scriptId}:${line}`); + SourcePlusPlus.debugLog(`Setting breakpoint at ${scriptId}:${line}`); if (this.pendingBreakpoints.has(scriptId + ':' + line)) { return this.pendingBreakpoints.get(scriptId + ':' + line); } @@ -260,7 +255,7 @@ export default class LiveInstrumentRemote { } async addInstrument(instrument: LiveInstrument): Promise { - debugLog(`Adding instrument: ${instrument.id}`); + SourcePlusPlus.debugLog(`Adding instrument: ${instrument.id}`); if (this.instruments.get(instrument.id) || this.instrumentCache.get(instrument.id)) { return; // Instrument already exists or is in the cache } @@ -295,7 +290,7 @@ export default class LiveInstrumentRemote { } removeInstrument(instrumentId: string) { - debugLog("Removing instrument: " + instrumentId); + SourcePlusPlus.debugLog("Removing instrument: " + instrumentId); let instrument = this.instruments.get(instrumentId); if (!instrument) { @@ -347,7 +342,7 @@ export default class LiveInstrumentRemote { } handleConditionalFailed(instrument: LiveInstrument, error: string) { - debugLog("Conditional failed for instrument: " + instrument.id + " - " + error); + SourcePlusPlus.debugLog("Conditional failed for instrument: " + instrument.id + " - " + error); this.removeInstrument(instrument.id); this.eventBus.publish("spp.processor.status.live-instrument-removed", { occurredAt: Date.now(), @@ -359,7 +354,7 @@ export default class LiveInstrumentRemote { // TODO: Call this regularly to clean up old instruments // TODO: Ensure the cache doesn't get too large private cleanCache() { - debugLog("Cleaning cache"); + SourcePlusPlus.debugLog("Cleaning cache"); let now = Date.now(); this.instrumentCache.forEach((value, key) => { if (now - value.timeCached > 1000 * 60 * 60) { diff --git a/src/util/SourceMapper.ts b/src/util/SourceMapper.ts index dc5ebdf..030fc86 100644 --- a/src/util/SourceMapper.ts +++ b/src/util/SourceMapper.ts @@ -3,12 +3,7 @@ import path from "path"; import * as fs from "fs"; import LiveSourceLocation from "../model/LiveSourceLocation"; import * as vlq from 'vlq'; - -function debugLog(...args: any[]) { - if (true) { //todo: debug - console.log(...args); - } -} +import SourcePlusPlus from "../SourcePlusPlus"; export default class SourceMapper { scriptLoaded: (sourceLocation: string, scriptId: string) => void; @@ -63,10 +58,10 @@ export default class SourceMapper { let mappedFile: MappedFile = this.mapped.get(location.source); if (!mappedFile) { - debugLog("SourceMapper.mapLocation", "No mapped file found for", location.source); + SourcePlusPlus.debugLog("SourceMapper.mapLocation", "No mapped file found for", location.source); return undefined; } - debugLog("SourceMapper.mapLocation", "Mapped file found for", location.source); + SourcePlusPlus.debugLog("SourceMapper.mapLocation", "Mapped file found for", location.source); return { scriptId: mappedFile.scriptId, From 903c5d61731e65aee4bb18e33b47643fe9cc8667 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Sun, 28 Aug 2022 17:33:05 +0400 Subject: [PATCH 8/8] refactor: debug logging --- src/control/ContextReceiver.ts | 6 ++++-- src/control/LiveInstrumentRemote.ts | 12 +++++++----- src/util/SourceMapper.ts | 6 ++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/control/ContextReceiver.ts b/src/control/ContextReceiver.ts index 210856c..c27a417 100644 --- a/src/control/ContextReceiver.ts +++ b/src/control/ContextReceiver.ts @@ -9,6 +9,8 @@ import VariableUtil from "../util/VariableUtil"; import ProbeMemory from "../ProbeMemory"; import SourcePlusPlus from "../SourcePlusPlus"; +const debugLog = (...args: any[]) => SourcePlusPlus.debugLog(args); + namespace ContextReceiver { let logReport; @@ -50,7 +52,7 @@ namespace ContextReceiver { export function applyBreakpoint(breakpointId: string, source: string | undefined, line: number, frames: Debugger.CallFrame[], variables) { - SourcePlusPlus.debugLog(`applyBreakpoint: ${breakpointId} ${source} ${line}`); + debugLog(`applyBreakpoint: ${breakpointId} ${source} ${line}`); let activeSpan = ContextManager.current.newLocalSpan(callFrameToString(frames[0])); activeSpan.start(); @@ -95,7 +97,7 @@ namespace ContextReceiver { } export function applyLog(liveLogId: string, logFormat: string, logArguments: any) { - SourcePlusPlus.debugLog(`applyLog: ${liveLogId} ${logFormat} ${logArguments}`); + debugLog(`applyLog: ${liveLogId} ${logFormat} ${logArguments}`); let logTags = new LogTags(); logTags.addData(new KeyStringValuePair().setKey('log_id').setValue(liveLogId)); logTags.addData(new KeyStringValuePair().setKey('level').setValue('Live')); diff --git a/src/control/LiveInstrumentRemote.ts b/src/control/LiveInstrumentRemote.ts index 5fc941a..777f1cd 100644 --- a/src/control/LiveInstrumentRemote.ts +++ b/src/control/LiveInstrumentRemote.ts @@ -11,6 +11,8 @@ import CommandType from "../model/command/CommandType"; import VariableUtil from "../util/VariableUtil"; import SourcePlusPlus from "../SourcePlusPlus"; +const debugLog = (...args: any[]) => SourcePlusPlus.debugLog(args); + export interface VariableInfo { block: Runtime.PropertyDescriptor[] local: Runtime.PropertyDescriptor[] @@ -222,7 +224,7 @@ export default class LiveInstrumentRemote { } private async setBreakpoint(scriptId: string, line: number): Promise { - SourcePlusPlus.debugLog(`Setting breakpoint at ${scriptId}:${line}`); + debugLog(`Setting breakpoint at ${scriptId}:${line}`); if (this.pendingBreakpoints.has(scriptId + ':' + line)) { return this.pendingBreakpoints.get(scriptId + ':' + line); } @@ -255,7 +257,7 @@ export default class LiveInstrumentRemote { } async addInstrument(instrument: LiveInstrument): Promise { - SourcePlusPlus.debugLog(`Adding instrument: ${instrument.id}`); + debugLog(`Adding instrument: ${instrument.id}`); if (this.instruments.get(instrument.id) || this.instrumentCache.get(instrument.id)) { return; // Instrument already exists or is in the cache } @@ -290,7 +292,7 @@ export default class LiveInstrumentRemote { } removeInstrument(instrumentId: string) { - SourcePlusPlus.debugLog("Removing instrument: " + instrumentId); + debugLog("Removing instrument: " + instrumentId); let instrument = this.instruments.get(instrumentId); if (!instrument) { @@ -342,7 +344,7 @@ export default class LiveInstrumentRemote { } handleConditionalFailed(instrument: LiveInstrument, error: string) { - SourcePlusPlus.debugLog("Conditional failed for instrument: " + instrument.id + " - " + error); + debugLog("Conditional failed for instrument: " + instrument.id + " - " + error); this.removeInstrument(instrument.id); this.eventBus.publish("spp.processor.status.live-instrument-removed", { occurredAt: Date.now(), @@ -354,7 +356,7 @@ export default class LiveInstrumentRemote { // TODO: Call this regularly to clean up old instruments // TODO: Ensure the cache doesn't get too large private cleanCache() { - SourcePlusPlus.debugLog("Cleaning cache"); + debugLog("Cleaning cache"); let now = Date.now(); this.instrumentCache.forEach((value, key) => { if (now - value.timeCached > 1000 * 60 * 60) { diff --git a/src/util/SourceMapper.ts b/src/util/SourceMapper.ts index 030fc86..e1b00bc 100644 --- a/src/util/SourceMapper.ts +++ b/src/util/SourceMapper.ts @@ -5,6 +5,8 @@ import LiveSourceLocation from "../model/LiveSourceLocation"; import * as vlq from 'vlq'; import SourcePlusPlus from "../SourcePlusPlus"; +const debugLog = (...args: any[]) => SourcePlusPlus.debugLog(args); + export default class SourceMapper { scriptLoaded: (sourceLocation: string, scriptId: string) => void; mapped: Map @@ -58,10 +60,10 @@ export default class SourceMapper { let mappedFile: MappedFile = this.mapped.get(location.source); if (!mappedFile) { - SourcePlusPlus.debugLog("SourceMapper.mapLocation", "No mapped file found for", location.source); + debugLog("SourceMapper.mapLocation", "No mapped file found for", location.source); return undefined; } - SourcePlusPlus.debugLog("SourceMapper.mapLocation", "Mapped file found for", location.source); + debugLog("SourceMapper.mapLocation", "Mapped file found for", location.source); return { scriptId: mappedFile.scriptId,