title: Angular 6: Made a log service... I need help getting the original file path
body: <p>In my angular project i have a _global function for logging stuff in the browser so i can turn on and off debug mode easy. My problem is the console reads the location of the logs are all from the _global file but im looking for an easy way to detect the original location of the _log</p>
  <h1>_global.ts</h1>
  <pre><code>export const _log = function(msg, style, data?) {
      if(this.mode.dev_mode){
          data = (data) ? data : '';
          let s = &quot;&quot;;
          switch ( style ) {
              case 't':
                  s = &quot;background: #222; color: #bada55&quot;;
                  break;
              case 'i':
                  s = &quot;background: #efefef; color: blue; 'font-weight:900;'&quot;;
                  break;
              case 'e':
                  s = &quot;background: red; color: white; 'font-weight:bold;'&quot;;
                  break;
              case 'd':
                  s = &quot;background: #333; color: white; 'font-weight:bold;'&quot;;
                  break;
              case 'y':
                  s = &quot;background: #FFBB3B; color: white; 'font-weight:bold;'&quot;;
                  break;
              case 's':
                  s = &quot;background: green; color: white; 'font-weight:bold;'&quot;;
                  break;
              default:
                 s = &quot;background: #222; color: #bada55&quot;;
          }
          console.log(`%c ${msg}`, s, data);
      }
  };
  </code></pre>
  <h1>example.component.ts</h1>
  <pre><code>_log(' == products ==&gt; ', 'i', products);
  </code></pre>
  <h1>screenshot</h1>
  <p><a href="https://i.stack.imgur.com/42kEO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/42kEO.png" alt="enter image description here" /></a></p>
  <h1>question</h1>
  <p>see how all logs say _global.ts what is an easy way to not somehow the original function usage? in this case for example would be <code>example.component.ts</code> instead of <code>_global.ts</code>... I could just type it out everytime but id rather something more automated and allows me to keep the _log() short.</p>