Las otras soluciones en este hilo no funcionaban en mi Mac. Aquí hay un registrador que guarda una representación de cadena intermitentemente usando ajax. usarlo en console.savelugar deconsole.log
var logFileString="";
var maxLogLength=1024*128;
console.save=function(){
var logArgs={};
for(var i=0; i<arguments.length; i++) logArgs['arg'+i]=arguments[i];
console.log(logArgs);
// keep a string representation of every log
logFileString+=JSON.stringify(logArgs,null,2)+'\n';
// save the string representation when it gets big
if(logFileString.length>maxLogLength){
// send a copy in case race conditions change it mid-save
saveLog(logFileString);
logFileString="";
}
};
dependiendo de lo que necesite, puede guardar esa cadena o simplemente console.logy copiar y pegar. Aquí hay un ajax para usted en caso de que quiera guardarlo:
function saveLog(data){
// do some ajax stuff with data.
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200) {}
}
xhttp.open("POST", 'saveLog.php', true);
xhttp.send(data);
}
la saveLog.phpdebe anexar los datos a un archivo de registro en alguna parte. No necesitaba esa parte, así que no la incluiré aquí. :)
https://www.google.com/search?q=php+append+to+log