tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

Set logging parameters? #1033

Closed lavahot closed 9 years ago

lavahot commented 9 years ago

I've been trying to find out how to set the level of logging that I want to do, as it's fairly annoying to get spammed with hundreds of map events in the console while I'm debugging. Is there some way to limit (or turn off) logging?

srthurman commented 9 years ago

My answer to issue 1026 should be what you're looking for.

lavahot commented 9 years ago

Can you set it to anything other than off?

srthurman commented 9 years ago

Using the config setting, you can only turn it to on or off. However, you can control which events get emitted, and thus logged, using the event-broadcast attribute. For example, if you set event-broadcast="events", then the following would log only the three events in the enable array:

$scope.events = {
                    map: {
                        enable: ['click', 'load', 'zoomstart'],
                        logic: 'broadcast'
                    }
                };

See the leafletMapEvents.js for the full list of possible events.

lavahot commented 9 years ago

Thanks @srthurman!

esetnik commented 8 years ago

I can't get the suggestion by @srthurman to work.

        $scope.map = {
            events: {
                map: {
                    enable: [],
                    logic: 'emit'
                },
                marker: {
                    enable: ['click'],
                    logic: 'emit'
                }
            },
            defaults: {
                tileLayerOptions: {
                    detectRetina: true,
                    reuseTiles: true
                }
            },
            center: {
                lat: 42.35321607653588,
                lng: -71.05476379394531,
                zoom: 12
            }
        };
        <leaflet center="map.center" defaults="map.defaults" event-broadcast="map.events" markers="map.markers"></leaflet>

All events for both map and marker are logged in the console. I would expect that only marker click events are logged.

MichaelOrdina commented 8 years ago

markers: { enable: ['click'], logic: 'emit' }

changing marker into markers worked for me @esetnik