jongpie/NebulaLogger

Add a way to enforce the usage of scenarios

Closed this issue · 1 comments

In complex orgs, scenario-based logging is a great way to help segment & control logging across different teams/packages/modules. However, right now, using scenarios is not enforced in any way. This means teams have to rely on using scenarios as a best practice, without having a way to truly require it to be used.

Nebula Logger should have a way to optionally enforce using scenarios. This will probably be controlled by a new LoggerParameter__mdt record (a new field on LoggerSettings__c is another potential option). When enabled, there are 2 possible ways it could behave - both have tradeoffs

  1. Don't save the log (silently discard the data) - this would prevent runtime errors, but may not be intuitive that the "lack of a scenario" is the reason for logging data not saving
  2. Throw a runtime exception (when calling Logger.saveLog() maybe?) - this approach would make it clear that logging isn't functioning due to "lack of a scenario", but has the downside of it interrupting any running code/customizations

This is now available in release v4.13.3