Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
Capture Console Output

I am looking for a way to capture the entire console dump and store it in javascript variable. I tried to set a global variable in javscript called console_output and then tried to set the valua of the variable console_output = window.console.log,however when I tried to print the console_output variable, it was empty

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Try like this thing

    console.logs = []
    console.logWidthRecord = function(...log)  {
    this.logs.push(...log)
    console.log(...log)
    } 

    console.logWidthRecord('test')
about 4 years ago · Juan Pablo Isaza Denunciar

0

you can use such snippet:

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

We bind console std and recreate log method with logs

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can redefine console.log, while keeping a reference to the original definition. Any call to console.log will then use the new function, in which you can do basically anything with the parameters.

The example below prints the parameters that it receives (by calling the original log function), along with some extra text. Storing the arguments somewhere is just as easily done.

const originalLog = console.log;
console.log = myLog;

function myLog() {
  originalLog(">> myLog begin (length = " + arguments.length + ")");
  originalLog.apply(this, arguments);
  originalLog("<< myLog end");
}

console.log(1, 2, 3);
console.log("Hello World");
console.log();
console.log([true]);

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda