NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

Fail to create logs on wire properties

Open jefersonchaves opened this issue 3 years ago • 3 comments

Package Edition of Nebula Logger

Unlocked Package

Package Version of Nebula Logger

4.6.16

New Bug Summary

First of all thanks for the logger.

In an attempt to log errors on a wire function then it errors out with the following error: Cannot read properties of undefined (reading 'supportedLoggingLevels')

The errors seem to be caused due to the fact the wire adapters are not predictable ordered.

I can try to update the component to use imperative retrieval of custom settings instead. This could potentially allow the usage of the logger without requiring to introduce it on markup.

jefersonchaves avatar Feb 23 '22 11:02 jefersonchaves

Hi @jefersonchaves - thanks for reporting the issue! I can try to look into this sometime over the next few weeks. Any chance you could provide some sample code that demonstrates the issue? Just want to be sure that I'm taking the right steps to reproduce the problem.

jongpie avatar Feb 23 '22 14:02 jongpie

Hey @jongpie - Thanks a lot for the reply, yes, it is something such as:

import ACCOUNT_OBJECT from '@salesforce/schema/Account';

@wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
accountObjectInfo({ data, error}) {
  if (data) {
    ...
  } else {
     logger.error('error retrieving Account info');
     logger.saveLog();
  }
}

If you need a more complete example please let me know, I will also try to play with the API to see if I can make a proposal.

jefersonchaves avatar Feb 23 '22 14:02 jefersonchaves

Perfect, thanks so much @jefersonchaves! Once I have a chance to do some testing, I'll let you know if I have any follow-up questions

jongpie avatar Feb 24 '22 12:02 jongpie

Hello @jongpie : I recently got some time to work on this. I can submit a PR tomorrow or early next week with my proposal for the LWC logger that will allow usage on wire methods and any other. The solution I plan to show you will enable use without adding the markup.

jefersonchaves avatar Oct 27 '22 22:10 jefersonchaves