console: fix trace function

A recent refactoring made the slight mistake of calling `trace()`
instead of `this.trace()`.

PR-URL: https://github.com/nodejs/node/pull/26764
Fixes: https://github.com/nodejs/node/issues/26763
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
Ruben Bridgewater 2019-03-19 01:56:32 +01:00
parent 296712602b
commit ab3f7afacc
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
3 changed files with 16 additions and 1 deletions

View File

@ -331,7 +331,7 @@ const consoleMethods = {
name: 'Trace',
message: this[kFormatForStderr](args)
};
Error.captureStackTrace(err, trace);
Error.captureStackTrace(err, this.trace);
this.error(err.stack);
},

5
test/message/console.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
require('../common');
console.trace('foo');

10
test/message/console.out Normal file
View File

@ -0,0 +1,10 @@
Trace: foo
at Object.trace (*)
at Object.<anonymous> (*console.js:*:*)
at *
at *
at *
at *
at *
at *
at *