A framework for enabling logging within Lightning Components.
Adding the lightingLogger component and related apex classes, extending that component to any additional components will allow a developer to toggle their console.log messages with a checkbox per user. This allows a clickable way to remove any unnecessary console.log messages for users not being used for testing/debugging purposes.
<aura:component extends="c:lightningLogger">
<!-- need to let the lightning logger component load first with debug status -->
<aura:handler name="change" value="{!v.isLoaded}" action="{!c.doInit}"/>
</aura:component>
({
doInit : function(component, event, helper) {
// represents a console.log('msg') type log
helper.log(component, 'basic log message!');
// represents a console.log('msg', obj) type log
helper.log(component, 'logger should console an object?', component);
}
})
({
helperMethod : function(component) {
this.log(component, 'logging in the helper too!');
}
})