简体   繁体   中英

How to export chrome console log

I have a question. When I type a lot of JS commands into a console log in Chrome, and I want to return it then, can I? Thank you Andrew

You can't. What's in the console can't be read from JavaScript.

What you can do is hook the console.log function so that you store when it logs:

console.stdlog = console.log.bind(console);
console.logs = [];
console.log = function(){
    console.logs.push(Array.from(arguments));
    console.stdlog.apply(console, arguments);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM