Skip to content

Feature: Add databaseResult, databaseResultList, and ignoreOrigin to CallableLogger - #1037

Open
jasonsiders wants to merge 15 commits into
jongpie:mainfrom
jasonsiders:feature/callable-logger-additional-args
Open

jasonsiders wants to merge 15 commits into
jongpie:mainfrom
jasonsiders:feature/callable-logger-additional-args

Conversation

@jasonsiders

Copy link
Copy Markdown
  • Resolves CallableLogger: accept database results in newEntry, and add an ignoreOrigin action #1036 by adding new newEntry arguments databaseResult and databaseResultList to CallableLogger, which pass Database results to the matching LogEntryEventBuilder.setDatabaseResult() overload, following the existing record and recordList arguments
  • Added a new CallableLogger action ignoreOrigin, which passes its apexType argument to Logger.ignoreOrigin(), so packages can hide their logging wrapper from origins and stack traces without admins setting up the IgnoredApexOrigins record
  • Added tests for each Database result type and for ignoreOrigin, and suppressed PMD.NcssCount rule on the test class.
  • Added examples to the README and updated the instrumentation skill

Accepts any single or List Database.*Result type that
LogEntryEventBuilder.setDatabaseResult has an overload for, so packages
calling Nebula through System.Callable can attach DML results to an entry.
Applied before the record arguments, so an explicit record wins over the
record ID a single result sets.
Lets packages calling Nebula through System.Callable exclude their own
classes from each entry's origin and stack trace in code, without an
admin adding them to the IgnoredApexOrigins LoggerParameter record.
Takes class names as strings so OmniStudio callers can use it too, and
skips blank names, which would otherwise break stack trace parsing.
Read databaseResult once, tighten the ordering comment and ApexDoc, and
use one mock result per list in the list test.
Wrap new comments, document the thrown exception, and drop a method-level
PMD suppression the analyzer does not need.
The new tests push the class past PMD's 500-statement limit. Matches the
class-level suppression in Logger_Tests, LogEntryEventBuilder_Tests,
LogEntryEventHandler_Tests, and LogEntryHandler_Tests.
Remove the null databaseResult test: with containsKey, a null value takes
the same unsupported-type path as any other value, like the other
arguments pass null straight through. Restore Nebula's aligned ApexDoc
continuation lines.
Mirror Logger.ignoreOrigin(System.Type) instead of taking a list of class
name strings: the action now delegates to the global method directly, so
it no longer depends on the deprecated LoggerStackTrace string overload,
and a null or missing apexType fails the same way Logger.ignoreOrigin
does, before anything is added to the ignored origins.
Match CallableLogger's one-key-per-shape convention (record, recordList,
recordMap): databaseResult takes a single Database result and
databaseResultList takes a list, each rejecting the other shape with an
IllegalArgumentException. Replace the looping tests with one test per
result type and shape, using the same assertions as the existing record
tests.
Cast databaseResultList at the call site, like recordList and tags, so a
single result passed as a list fails the same way a single record passed
as recordList does. Cover the unsupported list type branch with its own
test.
Add ignoreOrigin to the supported actions table and databaseResult /
databaseResultList to the newEntry input keys table, both marked Apex only.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CallableLogger: accept database results in newEntry, and add an ignoreOrigin action

1 participant