javascript - Create shortcut to console.log() in Chrome -


Because I'm lazy, I've created a log function that basically only Console.log :

  function log () {console.log.apply (console, logic); }   

Every time I call it, I see a log-in item in the Google Chrome Developer Tool, on the right side of which the item was logged. However, this line number is always the same, because the actual console.log is located in a specific location in the call code (i.e. where I declare the log function as above Am)).

Whatever I tried is just:

  var log = console.log;   

But it always throws an error: Invalid Orientation . Strange, but I think this is not a possibility.

How do I create a shortcut for console.log , showing line numbers with developer tools where logs actual console .log Where did the call go instead of being located?

When I reported it, it was rejected but the answer was simple - shortcut like this Create:

  var log = console.log.bind (console);   

This line does not leave the number, when you do this log (...) . Like you can call.

Comments