Logs can be filtered before sending
posthog-js@1.390.0
1 featureThis release1 featureNew capabilitiesAI-tallied from the release notes
1.390.0
Minor Changes
-
#3869
81b79fbThanks @turnipdabeets! - Add abeforeSendoption to the logs config, so you can inspect, redact, or drop log records before they're sent:posthog.init('<token>', { logs: { beforeSend: (log) => { // return null to drop the log, or return the (optionally modified) log to keep it if (log.body.includes('password')) { return null } return log }, }, })beforeSendaccepts a single function or an array of functions (applied left to right); returningnullfrom any of them drops the record. It runs for logs sent via bothposthog.captureLog()andposthog.logger.*. (2026-06-17)
Patch Changes
- Updated dependencies [
81b79fb]:- @posthog/types@1.390.0
Fetched June 17, 2026
