|
1 | 1 | import definition = require("console"); |
2 | 2 | import trace = require("trace"); |
| 3 | +import platform = require("platform"); |
3 | 4 |
|
4 | 5 | export class Console implements definition.Console { |
5 | 6 | private TAG: string = "JS"; |
@@ -249,29 +250,6 @@ export class Console implements definition.Console { |
249 | 250 | if (!test) { |
250 | 251 | Array.prototype.shift.apply(arguments); |
251 | 252 | this.error(this.formatParams.apply(this, arguments)); |
252 | | - |
253 | | - // duplicating trace code here because android version shows only 2 frames and if we call trace() |
254 | | - // this would be assert() and trace() which leaves all important stack frames out of our view |
255 | | - |
256 | | - //this._nativeClass.log('=== trace(): JS stack ===') |
257 | | - //if (i.TargetOS.Android == targetOS) { |
258 | | - // var e = <any>new Error('console.trace()'); |
259 | | - // this.log(e.stack); |
260 | | - //} |
261 | | - //else if (i.TargetOS.iOS == targetOS) { |
262 | | - // var callstack = []; |
263 | | - // var currentFunction = arguments.callee.caller; |
264 | | - // while (currentFunction) { |
265 | | - // var fn = currentFunction.toString(); |
266 | | - // var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('{')).trim() || 'anonymous'; |
267 | | - // if ('()' === fname) { |
268 | | - // fname = 'anonymous'; |
269 | | - // } |
270 | | - // callstack.push(fname); |
271 | | - // currentFunction = currentFunction.caller; |
272 | | - // this.log(callstack.join('\n')); |
273 | | - // } |
274 | | - //} |
275 | 253 | } |
276 | 254 | } |
277 | 255 |
|
@@ -380,7 +358,13 @@ export class Console implements definition.Console { |
380 | 358 | } |
381 | 359 |
|
382 | 360 | public dump(obj: any): void { |
383 | | - this.log(this.createDump(obj)); |
| 361 | + var dump = this.createDump(obj); |
| 362 | + |
| 363 | + if (platform.device.os === platform.platformNames.android) { |
| 364 | + this.log(dump); |
| 365 | + } else if (platform.device.os === platform.platformNames.ios) { |
| 366 | + console.log(dump); |
| 367 | + } |
384 | 368 | } |
385 | 369 |
|
386 | 370 | public dir = this.dump; |
|
0 commit comments