title: AngularJS circular dependency
body: <p>I'm making a logger service, to extend angular's $log service, by saving the errors (or debug if enabled) into an indexedDB database. Here's the code:</p>
  
  <pre><code>angular.module('appLogger', ['appDatabase'])
  
  .service('LogServices', function($log, Database) {
  
      // ...
  
      this.log = function(type, message, details) {
          var log = {};
          log.type = type
          log.context = this.context;
          log.message = message;
          log.dateTime = moment().format('YYYY-MM-DD HH:mm:ss');
          log.details = details || '';
          $log[type.toLowerCase()](log);
  
          if (type === 'ERROR' || this.logDebug) {
              Database.logSave(log);
          }
      };
  
      // ...
  })
  </code></pre>
  
  <p>This is working in my services as intended. Now the problem is I can't use my logger inside the Database service, because it throws a circular dependency error. I understand the problem but I have no clue how should I resolve it... How should I get around this ?</p>
  
  <p>Thanks for helping :-)</p>