title: is it possible to run a function before console.log("hello") in angular?
body: <p>the problem is very simple to understand yet tricky to implement.</p>
  <p>if i have a predefined function(not one that i make) <code>console.log(&quot;hello&quot;)</code>. I would like to modify <code>console.log()</code> so that when i run <code>console.log()</code> anywhere, i can run a function where i get the arguments make some changes, example &quot;hello&quot; becomes &quot;user1: hello&quot;.</p>
  <p>The only way i can think of is:</p>
  <pre><code>Function MyOwnConsoleLog(string){
     string = &quot;test.. &quot; + string;
     console.log(string);
  };
  
  console.log = myCustomConsoleLogFunction
  console.log(&quot;hello&quot;) //almost works!
  </code></pre>
  <p>This almost works but as you see console.log inside MyOwnConsoleLog is no longer console.log() XD which means that it will recurse infinitely and fail</p>
  <p>Is it possible to make this work, maybe with some console.log.bind()/.apply()/.xxx or something else?</p>
  <p>btw I have tried saving the old <code>console.log()</code> to another variable, but it seems pretty impossible to make a copy of this function, have tried alot of deep copies and other methods here at stackoverflow, none of them managed to make a fully working console.log() independent copy.</p>