Skip to content

Commit d0a0287

Browse files
committed
Add logs to debug in ubuntu
1 parent cc6ca80 commit d0a0287

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/datadog-instrumentations/src/fs.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ function createWrapFunction (prefix = '', override = '') {
259259
const operation = name.match(/^(.+?)(Sync)?(\.native)?$/)[1]
260260

261261
return function () {
262+
console.log(`wrapFunction => function(): name: ${name}, method: ${method}, operation: ${operation}`)
263+
console.log('startChannel._stores', startChannel._stores)
262264
if (!startChannel.hasSubscribers) return original.apply(this, arguments)
263-
265+
console.log(`HAS_SUBSCRIBERS - name: ${name}, method: ${method}, operation: ${operation}`)
264266
const lastIndex = arguments.length - 1
265267
const cb = typeof arguments[lastIndex] === 'function' && arguments[lastIndex]
266268
const params = getMethodParamsRelationByPrefix(prefix)[operation]
@@ -272,6 +274,7 @@ function createWrapFunction (prefix = '', override = '') {
272274
ctx.error = error
273275
errorChannel.publish(ctx)
274276
}
277+
console.log('finishChannel.runStores(ctx, cb)')
275278
return finishChannel.runStores(ctx, cb)
276279
}
277280

@@ -282,6 +285,7 @@ function createWrapFunction (prefix = '', override = '') {
282285
}
283286

284287
return startChannel.runStores(ctx, () => {
288+
console.log(`startChannel.runStores: name: ${name}, method: ${method}, operation: ${operation}`)
285289
if (abortController.signal.aborted) {
286290
const error = abortController.signal.reason || new Error('Aborted')
287291

@@ -319,7 +323,7 @@ function createWrapFunction (prefix = '', override = '') {
319323
}
320324
)
321325
}
322-
326+
console.log('finishChannel.runStores(ctx, () => {}): L324')
323327
finishChannel.runStores(ctx, () => {})
324328

325329
return result

packages/dd-trace/test/appsec/rasp/fs-plugin.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,11 @@ describe('AppsecFsPlugin', () => {
237237
storage('legacy').enterWith(origStore)
238238

239239
opFinishCh.subscribe(onFinish)
240+
console.log('BEFORE - fs.readFileSync')
240241

241242
fs.readFileSync(path.join(__dirname, 'fs-plugin.spec.js'))
242243

244+
console.log('AFTER - fs.readFileSync')
243245
assert.strictEqual(count, 0)
244246
} finally {
245247
opFinishCh.unsubscribe(onFinish)

0 commit comments

Comments
 (0)