Dump Chrome dev console to text file?

走远了吗. 提交于 2019-12-11 01:57:58

问题


Sometimes when I'm trying to debug an issue a user is having with my Chrome extension (StayFocusd), it would be useful to have access to the console logs. Right now I just ask them to copy-and-paste the log to me, but it would be nicer if I could programatically generate a file they could just email to me. Is that possible?

Alternately, is at least possible to capture the console contents with Javascript so I could output it to a useful debugging format for myself?


回答1:


There is an experimental API for that: chrome.experimental.devtools.console:

chrome.experimental.devtools.console.getMessages(function(messages) {
    messages[0].url  // http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
    messages[0].text // XHR finished loading
    messages[0].line // 4
})


来源:https://stackoverflow.com/questions/10311273/dump-chrome-dev-console-to-text-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!