Skip to content

CallableLogger newEntry doesn't suppose HttpRequest/HttpResponse #1023

Description

@simonfcodes

It's my first contribution to a public repo ever, so I hope I get this right. Happy to submit a PR for this if it's a welcome addition — wanted to check first per CONTRIBUTING.md.

I use the Callable interface for an internal project to allow logging from our custom exceptions and running into an issue where I cannot pass in HttpRequest/HttpResponse objects for logging.

LogEntryEventBuilder.setHttpRequestDetails() / setHttpResponseDetails() (added per #240) let Apex code logging via the direct Logger.newEntry(...) fluent API populate the HttpRequest*__c/HttpResponse*__c fields on LogEntryEvent__e/LogEntry__c.

But CallableLogger's newEntry action — the supported way for ISV/subscriber packages to integrate with Nebula Logger without a compile-time dependency on the Nebula namespace (per the Dynamically Call Nebula Logger wiki) — only recognizes exception, recordId/record/recordList/recordMap, tags, parentLogTransactionId, and saveLog as input arguments. There's no way to pass an HttpRequest/HttpResponse through the Callable bridge, so packages using it for loose coupling can't get HTTP-aware log entries at all today.

Proposed fix: add two new optional input keys to the newEntry action — httpRequest (System.HttpRequest, optionally paired with httpRequestHeadersToLog as List<String> to match the existing setHttpRequestDetails overload) and httpResponse (System.HttpResponse) — and call the existing setHttpRequestDetails()/setHttpResponseDetails() builder methods when present, following the same containsKey-guarded pattern already used for exception/record. No schema changes needed (the target fields already exist).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions