Wpd Ai Webhooks Enable Logging

Alpha Insights Documentation

Docs Navigation

Filter: wpd_ai_webhooks_enable_logging

Override whether webhook requests and responses are logged for debugging.

Description

The Webhooks integration can log outgoing requests and responses when “Enable Logging” is turned on in settings (stored in the webhook option). This filter receives that option-based value so you can force logging on or off regardless of the UI (e.g. always log in staging).

Location

File: includes/integrations/providers/wpdavies/webhooks/WPDAI_Webhook_Provider.php

Context: When determining whether to log webhook activity; the first parameter is the option value (enable_logging from settings).

Parameters

Parameter Type Description
$enable_log bool Whether logging is enabled from settings (true when the option is set)

Return

Type: bool

True to enable webhook logging; false to disable.

Example Usage

Always log in development

add_filter( 'wpd_ai_webhooks_enable_logging', 'wpd_webhooks_log_in_dev' );
function wpd_webhooks_log_in_dev( $enable_log ) {
    if ( wp_get_environment_type() === 'development' ) {
        return true;
    }
    return $enable_log;
}

Disable logging in production

add_filter( 'wpd_ai_webhooks_enable_logging', function( $enable_log ) {
    return wp_get_environment_type() !== 'production' && $enable_log;
} );

Related

Got A Question?

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Alpha Insights

Alpha Insights

The World's Most Advanced WooCommerce Profit Reporting Engine

5/5 – Trustpilot

Alpha Insights