Delete all console logs

Asked

Viewed 781 times

5

there is some way to delete all logs from the console and start again, like I inserted several logs there using console.log, but I want to remove all of them at once and start again by inserting others..

I read about console.clear() only nothing happens..

  • 1

    console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

  • Good question! I wanted to know a way to clean the entire console after a secret operation (like a login via Ajax), because the confidential data is in the console (not exactly in the log area, but still available) and I don’t know how to clean them... >:(

  • console.clear() seems to work Jsfiddle :/

  • @abfurlan works not... http://jsfiddle.net/p958ra5f/4/

  • Here it works, Chrome still displays the message Console was cleared, in FF also tested and works. Which browser you are using?

  • this message appears here too but logs are not deleted.. @abfurlan

  • The check is enabled Preserve log?

  • I don’t know, I use Chrome on Mac OS @abfurlan

  • 1

    Got it, check out this link API console

  • 1

    also use shortcuts like CTRL+L

Show 5 more comments

2 answers

7


The command to clear the console is console.clear().

If you are not cleaning the console, you should have the option Preserve log enabled. This option serves to prevent other scripts from clearing the console, making it difficult to debug the code.

inserir a descrição da imagem aqui

0

Supports Chrome & IE, not tested Opera and Firefox for testing is thanks.

While error is just look at the tutorial https://msdn.microsoft.com/pt-br/library/dd548687(v=vs.94). aspx

see you around

(function(){
  var msdn = console;
  Object.defineProperty( eval, "console", {
  get : function(){
      if( msdn._commandLineAPI ){
      throw "Navegador não suporta o objeto defineProperty!";
          }
      return msdn; 
  },
  set : function(val){
      msdn = val;
  }
  });
})();
<script>
// TESTE de enviar console.log
console.log("OI BRASIL");
console.log("TESTADO");
console.log = function() {};
console.log("BORA OLIMPIADAS");
</script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.