Skip to content

Commit 2938bbf

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

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/datadog-instrumentations/src/fs.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ 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}`)
262263
if (!startChannel.hasSubscribers) return original.apply(this, arguments)
263-
264+
console.log(`HAS_SUBSCRIBERS - name: ${name}, method: ${method}, operation: ${operation}`)
264265
const lastIndex = arguments.length - 1
265266
const cb = typeof arguments[lastIndex] === 'function' && arguments[lastIndex]
266267
const params = getMethodParamsRelationByPrefix(prefix)[operation]
@@ -272,6 +273,7 @@ function createWrapFunction (prefix = '', override = '') {
272273
ctx.error = error
273274
errorChannel.publish(ctx)
274275
}
276+
console.log('finishChannel.runStores(ctx, cb)')
275277
return finishChannel.runStores(ctx, cb)
276278
}
277279

@@ -282,6 +284,7 @@ function createWrapFunction (prefix = '', override = '') {
282284
}
283285

284286
return startChannel.runStores(ctx, () => {
287+
console.log(`startChannel.runStores: name: ${name}, method: ${method}, operation: ${operation}`)
285288
if (abortController.signal.aborted) {
286289
const error = abortController.signal.reason || new Error('Aborted')
287290

@@ -319,7 +322,7 @@ function createWrapFunction (prefix = '', override = '') {
319322
}
320323
)
321324
}
322-
325+
console.log('finishChannel.runStores(ctx, () => {}): L324')
323326
finishChannel.runStores(ctx, () => {})
324327

325328
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)