Skip to content

Commit

Permalink
issue #829 new independent logger
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Sep 3, 2015
1 parent 4478d44 commit 4f35bf6
Show file tree
Hide file tree
Showing 36 changed files with 255 additions and 182 deletions.
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
],
"dependencies": {
"angular": "1.x",
"angular-simple-logger": "~0.0.1",
"leaflet": "0.7.x"
},
"devDependencies": {
Expand Down
142 changes: 83 additions & 59 deletions dist/angular-leaflet-directive.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/angular-leaflet-directive.min.js

Large diffs are not rendered by default.

142 changes: 83 additions & 59 deletions dist/angular-leaflet-directive_dev_mapped.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/angular-leaflet-directive_dev_mapped.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/directives/bounds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('bounds', function ($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
angular.module("leaflet-directive").directive('bounds', function (leafletLogger, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
5 changes: 3 additions & 2 deletions src/directives/center.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var centerDirectiveTypes = ['center', 'lfCenter'],
centerDirectives = {};

centerDirectiveTypes.forEach(function(directiveName) {
centerDirectives[directiveName] = function($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
centerDirectives[directiveName] = function(leafletLogger, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
leafletBoundsHelpers, leafletEvents) {

var isDefined = leafletHelpers.isDefined,
Expand All @@ -12,7 +12,8 @@ centerDirectiveTypes.forEach(function(directiveName) {
isValidCenter = leafletHelpers.isValidCenter,
isValidBounds = leafletBoundsHelpers.isValidBounds,
isUndefinedOrEmpty = leafletHelpers.isUndefinedOrEmpty,
errorHeader = leafletHelpers.errorHeader;
errorHeader = leafletHelpers.errorHeader,
$log = leafletLogger;

var shouldInitializeMapWithBounds = function(bounds, center) {
return isDefined(bounds) && isValidBounds(bounds) && isUndefinedOrEmpty(center);
Expand Down
3 changes: 2 additions & 1 deletion src/directives/controls.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('controls', function ($log, leafletHelpers, leafletControlHelpers) {
angular.module("leaflet-directive").directive('controls', function (leafletLogger, leafletHelpers, leafletControlHelpers) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
3 changes: 2 additions & 1 deletion src/directives/decorations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive("decorations", function($log, leafletHelpers) {
angular.module("leaflet-directive").directive("decorations", function(leafletLogger, leafletHelpers) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
3 changes: 2 additions & 1 deletion src/directives/eventBroadcast.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('eventBroadcast', function ($log, $rootScope, leafletHelpers, leafletEvents, leafletIterators) {
angular.module("leaflet-directive").directive('eventBroadcast', function (leafletLogger, $rootScope, leafletHelpers, leafletEvents, leafletIterators) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
4 changes: 2 additions & 2 deletions src/directives/geojson.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
angular.module("leaflet-directive")
.directive('geojson', function ($log, $rootScope, leafletData, leafletHelpers,
.directive('geojson', function (leafletLogger, $rootScope, leafletData, leafletHelpers,
leafletWatchHelpers, leafletDirectiveControlsHelpers,leafletIterators,
leafletGeoJsonEvents) {

var _maybeWatch = leafletWatchHelpers.maybeWatch,
_watchOptions = leafletHelpers.watchOptions,
_extendDirectiveControls = leafletDirectiveControlsHelpers.extend,
hlp = leafletHelpers,
$it = leafletIterators;
// $log = leafletLogger;

return {
restrict: "A",
Expand Down
3 changes: 2 additions & 1 deletion src/directives/layercontrol.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('layercontrol', function ($filter, $log, leafletData, leafletHelpers) {
angular.module("leaflet-directive").directive('layercontrol', function ($filter, leafletLogger, leafletData, leafletHelpers) {
var $log = leafletLogger;
return {
restrict: "E",
scope: {
Expand Down
3 changes: 2 additions & 1 deletion src/directives/layers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('layers', function ($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
angular.module("leaflet-directive").directive('layers', function (leafletLogger, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
// var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
2 changes: 1 addition & 1 deletion src/directives/leaflet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("leaflet-directive", []).directive('leaflet',
angular.module("leaflet-directive", ['nemLogging']).directive('leaflet',
function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletEvents) {
return {
restrict: "EA",
Expand Down
5 changes: 3 additions & 2 deletions src/directives/legend.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('legend', function ($log, $http, leafletHelpers, leafletLegendHelpers) {
angular.module("leaflet-directive").directive('legend', function (leafletLogger, $http, leafletHelpers, leafletLegendHelpers) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down Expand Up @@ -27,7 +28,7 @@ angular.module("leaflet-directive").directive('legend', function ($log, $http, l
position = newLegend.position || 'bottomright';

// default to arcgis
type = newLegend.type || 'arcgis';
type = newLegend.type || 'arcgis';
}

}, true);
Expand Down
5 changes: 3 additions & 2 deletions src/directives/markers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module("leaflet-directive").directive('markers',
function ($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
function (leafletLogger, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
leafletMarkersHelpers, leafletMarkerEvents, leafletIterators, leafletWatchHelpers,
leafletDirectiveControlsHelpers) {
//less terse vars to helpers
Expand All @@ -16,7 +16,8 @@ angular.module("leaflet-directive").directive('markers',
$it = leafletIterators,
_markersWatchOptions = leafletHelpers.watchOptions,
maybeWatch = leafletWatchHelpers.maybeWatch,
extendDirectiveControls = leafletDirectiveControlsHelpers.extend;
extendDirectiveControls = leafletDirectiveControlsHelpers.extend,
$log = leafletLogger;

var _getLMarker = function(leafletMarkers, name, maybeLayerName){
if(!Object.keys(leafletMarkers).length) return;
Expand Down
3 changes: 2 additions & 1 deletion src/directives/maxbounds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('maxbounds', function ($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
angular.module("leaflet-directive").directive('maxbounds', function (leafletLogger, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
// var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
3 changes: 2 additions & 1 deletion src/directives/paths.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('paths', function ($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletEvents) {
angular.module("leaflet-directive").directive('paths', function (leafletLogger, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletEvents) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
3 changes: 2 additions & 1 deletion src/directives/tiles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("leaflet-directive").directive('tiles', function ($log, leafletData, leafletMapDefaults, leafletHelpers) {
angular.module("leaflet-directive").directive('tiles', function (leafletLogger, leafletData, leafletMapDefaults, leafletHelpers) {
var $log = leafletLogger;
return {
restrict: "A",
scope: false,
Expand Down
5 changes: 3 additions & 2 deletions src/directives/watchOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
['markers', 'geojson'].forEach(function(name){
angular.module("leaflet-directive").directive(name + 'WatchOptions', [
'$log', '$rootScope', '$q', 'leafletData', 'leafletHelpers',
function ($log, $rootScope, $q, leafletData, leafletHelpers) {
function (leafletLogger, $rootScope, $q, leafletData, leafletHelpers) {

var isDefined = leafletHelpers.isDefined,
errorHeader = leafletHelpers.errorHeader,
isObject = leafletHelpers.isObject,
_watchOptions = leafletHelpers.watchOptions;
_watchOptions = leafletHelpers.watchOptions,
$log = leafletLogger;

return {
restrict: "A",
Expand Down
5 changes: 3 additions & 2 deletions src/services/events/leafletEventsHelpers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
angular.module("leaflet-directive")
.factory('leafletEventsHelpersFactory', function ($rootScope, $q, $log, leafletHelpers) {
.factory('leafletEventsHelpersFactory', function ($rootScope, $q, leafletLogger, leafletHelpers) {
var safeApply = leafletHelpers.safeApply,
isDefined = leafletHelpers.isDefined,
isObject = leafletHelpers.isObject,
isArray = leafletHelpers.isArray,
errorHeader = leafletHelpers.errorHeader;
errorHeader = leafletHelpers.errorHeader,
$log = leafletLogger;;

var EventsHelper = function(rootBroadcastName, lObjectType){
this.rootBroadcastName = rootBroadcastName;
Expand Down
7 changes: 2 additions & 5 deletions src/services/events/leafletGeoJsonEvents.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
angular.module("leaflet-directive")
.factory('leafletGeoJsonEvents', function ($rootScope, $q, $log, leafletHelpers,
.factory('leafletGeoJsonEvents', function ($rootScope, $q, leafletLogger, leafletHelpers,
leafletEventsHelpersFactory, leafletLabelEvents, leafletData) {
var safeApply = leafletHelpers.safeApply,
isDefined = leafletHelpers.isDefined,
Helpers = leafletHelpers,
lblHelp = leafletLabelEvents,
EventsHelper = leafletEventsHelpersFactory;

// $log = leafletLogger;

var GeoJsonEvents = function(){
EventsHelper.call(this,'leafletDirectiveGeoJson', 'geojson');
Expand Down
6 changes: 4 additions & 2 deletions src/services/events/leafletLabelEvents.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
angular.module("leaflet-directive")
.factory('leafletLabelEvents', function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpersFactory) {
.factory('leafletLabelEvents', function ($rootScope, $q, leafletLogger, leafletHelpers, leafletEventsHelpersFactory) {
var Helpers = leafletHelpers,
EventsHelper = leafletEventsHelpersFactory;
EventsHelper = leafletEventsHelpersFactory;
//$log = leafletLogger;

var LabelEvents = function(){
EventsHelper.call(this,'leafletDirectiveLabel', 'markers');
};
Expand Down
11 changes: 4 additions & 7 deletions src/services/events/leafletMapEvents.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
angular.module("leaflet-directive")
.factory('leafletMapEvents', function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers) {
var safeApply = leafletHelpers.safeApply,
isDefined = leafletHelpers.isDefined,
isObject = leafletHelpers.isObject,
Helpers = leafletHelpers,
errorHeader = leafletHelpers.errorHeader,
fire = leafletEventsHelpers.fire;
.factory('leafletMapEvents', function ($rootScope, $q, leafletLogger, leafletHelpers, leafletEventsHelpers) {
var isDefined = leafletHelpers.isDefined,
fire = leafletEventsHelpers.fire,
$log = leafletLogger;

var _getAvailableMapEvents = function() {
return [
Expand Down
5 changes: 3 additions & 2 deletions src/services/events/leafletMarkerEvents.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
angular.module("leaflet-directive")
.factory('leafletMarkerEvents', function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpersFactory, leafletLabelEvents) {
.factory('leafletMarkerEvents', function ($rootScope, $q, leafletLogger, leafletHelpers, leafletEventsHelpersFactory, leafletLabelEvents) {
var safeApply = leafletHelpers.safeApply,
isDefined = leafletHelpers.isDefined,
Helpers = leafletHelpers,
lblHelp = leafletLabelEvents,
EventsHelper = leafletEventsHelpersFactory;
EventsHelper = leafletEventsHelpersFactory,
$log = leafletLogger;

var MarkerEvents = function(){
EventsHelper.call(this,'leafletDirectiveMarker', 'markers');
Expand Down
8 changes: 4 additions & 4 deletions src/services/events/leafletPathEvents.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
angular.module("leaflet-directive")
.factory('leafletPathEvents', function ($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
var safeApply = leafletHelpers.safeApply,
isDefined = leafletHelpers.isDefined,
.factory('leafletPathEvents', function ($rootScope, $q, leafletLogger, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
var isDefined = leafletHelpers.isDefined,
isObject = leafletHelpers.isObject,
Helpers = leafletHelpers,
errorHeader = leafletHelpers.errorHeader,
lblHelp = leafletLabelEvents,
fire = leafletEventsHelpers.fire;
fire = leafletEventsHelpers.fire,
$log = leafletLogger;

var _genDispatchPathEvent = function (eventName, logic, leafletScope, lObject, name, model, layerName) {
return function (e) {
Expand Down
5 changes: 3 additions & 2 deletions src/services/leafletBoundsHelpers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
angular.module("leaflet-directive").factory('leafletBoundsHelpers', function ($log, leafletHelpers) {
angular.module("leaflet-directive").factory('leafletBoundsHelpers', function (leafletLogger, leafletHelpers) {

var isArray = leafletHelpers.isArray,
isNumber = leafletHelpers.isNumber,
isFunction = leafletHelpers.isFunction,
isDefined = leafletHelpers.isDefined;
isDefined = leafletHelpers.isDefined,
$log = leafletLogger;

function _isValidBounds(bounds) {
return angular.isDefined(bounds) && angular.isDefined(bounds.southWest) &&
Expand Down
13 changes: 7 additions & 6 deletions src/services/leafletControlHelpers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
angular.module("leaflet-directive").factory('leafletControlHelpers', function ($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var createLayer = leafletLayerHelpers.createLayer;
var _controls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
angular.module("leaflet-directive").factory('leafletControlHelpers', function ($rootScope, leafletLogger, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined,
isObject = leafletHelpers.isObject,
createLayer = leafletLayerHelpers.createLayer,
_controls = {},
errorHeader = leafletHelpers.errorHeader + ' [Controls] ',
$log = leafletLogger;

var _controlLayersMustBeVisible = function(baselayers, overlays, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
Expand Down
3 changes: 2 additions & 1 deletion src/services/leafletData.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
angular.module("leaflet-directive").service('leafletData', function ($log, $q, leafletHelpers) {
angular.module("leaflet-directive").service('leafletData', function (leafletLogger, $q, leafletHelpers) {
var getDefer = leafletHelpers.getDefer,
getUnresolvedDefer = leafletHelpers.getUnresolvedDefer,
setResolvedDefer = leafletHelpers.setResolvedDefer;
// $log = leafletLogger;

var _private = {};
var self = this;
Expand Down
5 changes: 3 additions & 2 deletions src/services/leafletDirectiveControlsHelpers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
angular.module("leaflet-directive")
.service('leafletDirectiveControlsHelpers', function ($log, leafletData, leafletHelpers) {
.service('leafletDirectiveControlsHelpers', function (leafletLogger, leafletData, leafletHelpers) {
var _isDefined = leafletHelpers.isDefined,
_isString = leafletHelpers.isString,
_isObject = leafletHelpers.isObject,
_mainErrorHeader = leafletHelpers.errorHeader;
_mainErrorHeader = leafletHelpers.errorHeader,
$log = leafletLogger;

var _errorHeader = _mainErrorHeader + '[leafletDirectiveControlsHelpers';

Expand Down
3 changes: 2 additions & 1 deletion src/services/leafletIterators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('leaflet-directive').service('leafletIterators', function ($log, leafletHelpers) {
angular.module('leaflet-directive').service('leafletIterators', function (leafletLogger, leafletHelpers) {

var lHlp = leafletHelpers,
errorHeader = leafletHelpers.errorHeader + 'leafletIterators: ';
Expand All @@ -7,6 +7,7 @@ angular.module('leaflet-directive').service('leafletIterators', function ($log,
var _keys = Object.keys;
var _isFunction = lHlp.isFunction;
var _isObject = lHlp.isObject;
var $log = leafletLogger;

// Helper for collection methods to determine whether a collection
// should be iterated as an array or as an object
Expand Down
3 changes: 2 additions & 1 deletion src/services/leafletLayerHelpers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
angular.module("leaflet-directive")
.factory('leafletLayerHelpers', function ($rootScope, $q, $log, leafletHelpers, leafletIterators) {
.factory('leafletLayerHelpers', function ($rootScope, $q, leafletLogger, leafletHelpers, leafletIterators) {
var Helpers = leafletHelpers;
var isString = leafletHelpers.isString;
var isObject = leafletHelpers.isObject;
var isArray = leafletHelpers.isArray;
var isDefined = leafletHelpers.isDefined;
var errorHeader = leafletHelpers.errorHeader;
var $it = leafletIterators;
var $log = leafletLogger;

var utfGridCreateLayer = function(params) {
if (!Helpers.UTFGridPlugin.isLoaded()) {
Expand Down
5 changes: 3 additions & 2 deletions src/services/leafletMarkersHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("leaflet-directive").service('leafletMarkersHelpers', function ($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
angular.module("leaflet-directive").service('leafletMarkersHelpers', function ($rootScope, $timeout, leafletHelpers, leafletLogger, $compile, leafletGeoJsonHelpers) {
var isDefined = leafletHelpers.isDefined,
defaultTo = leafletHelpers.defaultTo,
MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin,
Expand All @@ -13,7 +13,8 @@ angular.module("leaflet-directive").service('leafletMarkersHelpers', function ($
isObject = leafletHelpers.isObject,
groups = {},
geoHlp = leafletGeoJsonHelpers,
errorHeader = leafletHelpers.errorHeader;
errorHeader = leafletHelpers.errorHeader,
$log = leafletLogger;


var _string = function (marker) {
Expand Down
6 changes: 4 additions & 2 deletions src/services/leafletPathsHelpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
angular.module("leaflet-directive").factory('leafletPathsHelpers', function ($rootScope, $log, leafletHelpers) {
angular.module("leaflet-directive").factory('leafletPathsHelpers', function ($rootScope, leafletLogger, leafletHelpers) {
var isDefined = leafletHelpers.isDefined,
isArray = leafletHelpers.isArray,
isNumber = leafletHelpers.isNumber,
isValidPoint = leafletHelpers.isValidPoint;
isValidPoint = leafletHelpers.isValidPoint,
$log = leafletLogger;

var availableOptions = [
// Path options
'stroke', 'weight', 'color', 'opacity',
Expand Down
3 changes: 3 additions & 0 deletions src/services/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
angular.module("leaflet-directive").service('leafletLogger', function(nemSimpleLogger) {
return nemSimpleLogger.spawn();
});
3 changes: 2 additions & 1 deletion test/karma-unit.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ module.exports = function(karma) {
files: [
'bower_components/leaflet/dist/leaflet-src.js',
'bower_components/angular/angular.js',
'bower_components/leaflet.markercluster/dist/leaflet.markercluster.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-simple-logger/dist/index.js',
'bower_components/leaflet.markercluster/dist/leaflet.markercluster.js',
'dist/angular-leaflet-directive_dev_mapped.js',
'test/unit/bootstrap.coffee',
'test/unit/*.js',
Expand Down

0 comments on commit 4f35bf6

Please sign in to comment.