Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
How to wrap console.log in global scope?

I am writing a browser extension that needs to get some info from an existing site. The site is exposed to me in the Chrome inspector as a collection of JavaScript files under the Sources tab. Fortuitously, all the info I need is logged via console.log from this existing website. Less fortuitously, I do not know of a way to "hot load" in hooks to these source files and though I can see the data in the console, I can't directly get the data in my extension where I can process it.

The answer to this question about accessing the console output does work to replace console.log within the file scope of my Main.js for my extension and causes a "console.logs" array to be built. But any console.log events occurring in the site's js files still appear to be default - I've tried a few permutations but they appear to just be vanilla log with no extra data capturing possible.

I assume my problem is one of scope. So, how could I inject this console.log replacement into a higher scope such that the site's js files also are affected? Failing this, is there another way to hook into this console data, or "hot swap" the site's source files with my own (e.g. replace the text of the JS files by regex prior to execution? I doubt it...)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda