Skip to content

Commit

Permalink
re-enable logging with localGeocoder and filters
Browse files Browse the repository at this point in the history
  • Loading branch information
mpothier committed Sep 11, 2024
1 parent 08377cc commit 85fef67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,6 @@ MapboxEventManager.prototype = {
shouldEnableLogging: function(options){
if (options.enableEventLogging === false) return false;
if (options.origin && options.origin !== 'https://api.mapbox.com') return false;
// hard to make sense of events when a local instance is suplementing results from origin
if (options.localGeocoder) return false;
// hard to make sense of events when a custom filter is in use
if (options.filter) return false;
return true;
},

Expand Down
4 changes: 2 additions & 2 deletions test/events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ test('should enable logging', function(assert){
assert.true(eventsManagerMapbox.shouldEnableLogging(mapboxOptions), 'logging is enabled when origin is mapbox');

mapboxOptions.filter = function(){return true};
assert.false(eventsManagerMapbox.shouldEnableLogging(mapboxOptions), 'logging is disabled when a custom filter is enabled');
assert.true(eventsManagerMapbox.shouldEnableLogging(mapboxOptions), 'logging is disabled when a custom filter is enabled');

mapboxOptions.filter = undefined;
mapboxOptions.localGeocoder = function(){return 'abc'}
assert.false(eventsManagerMapbox.shouldEnableLogging(mapboxOptions), 'logging is disabled when a custom geocoder is enabled');
assert.true(eventsManagerMapbox.shouldEnableLogging(mapboxOptions), 'logging is disabled when a custom geocoder is enabled');

assert.end();
});
Expand Down

0 comments on commit 85fef67

Please sign in to comment.