久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用chrome或firefox在javascript中將console.trace(

How to get result of console.trace() as string in javascript with chrome or firefox?(如何使用chrome或firefox在javascript中將console.trace()的結(jié)果作為字符串?)
本文介紹了如何使用chrome或firefox在javascript中將console.trace()的結(jié)果作為字符串?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

console.trace() 在控制臺(tái)上輸出結(jié)果.
我想以字符串形式獲取結(jié)果并將它們保存到文件中.

我沒有為函數(shù)定義名稱,也無法使用 callee.caller.name 獲取它們的名稱.

console.trace() outputs its result on console.
I want to get the results as string and save them to a file.

I don't define names for functions and I also can not get their names with callee.caller.name.

推薦答案

我不確定 firefox,但在 v8/chrome 中,您可以在 Error 構(gòu)造函數(shù)上使用名為 captureStackTrace 的方法.(更多信息在這里)

I'm not sure about firefox, but in v8/chrome you can use a method on the Error constructor called captureStackTrace. (More info here)

因此,獲得它的一種 hacky 方法是:

So a hacky way to get it would be:

var getStackTrace = function() {
  var obj = {};
  Error.captureStackTrace(obj, getStackTrace);
  return obj.stack;
};

console.log(getStackTrace());

通常,getStackTrace 在被捕獲時(shí)會(huì)在堆棧上.那里的第二個(gè)參數(shù)將 getStackTrace 排除在堆棧跟蹤中.

Normally, getStackTrace would be on the stack when it's captured. The second argument there excludes getStackTrace from being included in the stack trace.

這篇關(guān)于如何使用chrome或firefox在javascript中將console.trace()的結(jié)果作為字符串?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進(jìn)程中創(chuàng)建子窗口時(shí)如何修復(fù) BrowserWindow 不是構(gòu)造函數(shù)錯(cuò)誤) - IT屋-程序員軟件開發(fā)技術(shù)
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應(yīng)用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個(gè) loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內(nèi)使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲(chǔ)?)
How to access camera/webcamera inside electron app?(如何在電子應(yīng)用程序中訪問相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 亚洲国产精品成人久久久 | 国产精品免费一区二区 | 中文字幕av一区二区三区 | 伦理片97| 久久香蕉精品视频 | www精品美女久久久tv | 精品一区二区在线视频 | 亚洲国产黄色av | 亚洲福利在线观看 | 久久成人一区 | 亚洲精品一区二区三区丝袜 | 亚洲一区二区三区福利 | 中文字幕第一页在线 | 99精品一区二区 | 欧美黑人狂野猛交老妇 | 欧美日韩电影免费观看 | 日本xx视频免费观看 | 2018天天干天天操 | 午夜在线观看免费 | 日日干干 | 国产精品高清在线 | 久久久久久久久一区 | 精品国产综合 | 日本免费视频 | 久久久成人免费视频 | 亚洲国产高清高潮精品美女 | 国产乱码精品一区二区三区忘忧草 | 日韩精品免费播放 | 9久久精品 | 日韩av中文 | 国产成人精品久久二区二区91 | 国产特一级黄色片 | 婷婷色成人 | 国产不卡视频 | 免费一级淫片aaa片毛片a级 | 亚洲精品在线免费 | 国产成人精品午夜 | 99精品国产一区二区三区 | 欧美日韩一二区 | 亚洲精品中文在线 | 自拍偷拍中文字幕 |