I have made a test Lighting app to figure out why error catching isn't working as I expected.
Component: aura:component
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>
Controller:
({
// Handle component initialization
doInit : function(component, event, helper) {
$A.logger.subscribe("INFO", logCustom);
$A.log('initialized logger');
function logCustom(level, message, error) {
console.log(getTimestamp());
console.log(error);
console.log(error.stack)
}
function getTimestamp() {
return new Date().toJSON();
}
}
})
Error:
"Something has gone wrong. Error during init [Action failed: c$JQTest$controller$doInit [TypeError: Cannot read property 'subscribe' of undefined]]"
heroku lightning:lint
error aura-api Invalid Aura API
Line:4:9
$A.logger.subscribe("INFO", logCustom);
^
Perhaps I'm super confused... is $A.logger no longer supported? If not what is the new preferred way to catch errors? Thanks!