code: function (data) {
            //If a token is not configured, don't do anything.
            if (!token || !loggingEnabled) {
              return;
            }
  
            //TODO we're injecting this here to resolve circular dependency issues.  Is this safe?
            var $window = $injector.get( '$window' );
            var $location = $injector.get( '$location' );
  		   //we're injecting $http
            var $http = $injector.get( '$http' );
  
            lastLog = new Date();
  
            var sentData = angular.extend({}, extra, data);
  
            if (includeCurrentUrl) {
              sentData.url = $location.absUrl();
            }
  
            if( includeTimestamp ) {
              sentData.timestamp = lastLog.toISOString();
            }
  
            if( includeUserAgent ) {
              sentData.userAgent = $window.navigator.userAgent;
            }
  
            //Loggly's API doesn't send us cross-domain headers, so we can't interact directly
             //Set header
            var config = {
              headers: {
               'Content-Type': 'text/plain'
              },
              withCredentials: false
            };
  
            if (deleteHeaders) {
              //Delete other headers - this tells browser it's no need to pre-flight OPTIONS request
              var headersToDelete = Object.keys($http.defaults.headers.common).concat(Object.keys($http.defaults.headers.post));
              headersToDelete = headersToDelete.filter(function(item) {
                return item !== 'Accept' && item !== 'Content-Type';
              });
  
              for (var index = 0; index < headersToDelete.length; index++) {
                var headerName = headersToDelete[index];
                config.headers[headerName] = undefined;
              }
            }
  
            // Apply labels
            for (var label in labels) {
              if (label in sentData) {
                sentData[labels[label]] = sentData[label];
                delete sentData[label];
              }
            }
  
            //Ajax call to send data to loggly
            $http.post(buildUrl(),sentData,config).catch(console.error);
          }
docs: Send the specified data to loggly as a json message.
  @param data