Wpd Ai Session Tracking Enable Logging

Alpha Insights Documentation

Docs Navigation

Filter: wpd_ai_session_tracking_enable_logging

Enable or disable debug logging for session tracking.

Description

When enabled, session tracking writes log messages via wpdai_write_log() (e.g. session creation, expiry). Errors are always logged to the error log. This filter is checked each time a log is written, so you can turn logging on without a settings UI.

Location

File: includes/classes/WPDAI_Session_Tracking.php

Context: Inside the private log() method when deciding whether to write to the session_tracking log.

Parameters

Parameter Type Description
$enable_logging bool Current value (default false). Return true to enable session tracking debug logs.

Return

Type: bool

True to enable session tracking logging; false to disable.

Example Usage

Enable logging when WP_DEBUG is on

add_filter( 'wpd_ai_session_tracking_enable_logging', 'wpd_ai_session_log_when_debug' );
function wpd_ai_session_log_when_debug( $enable_logging ) {
    return defined( 'WP_DEBUG' ) && WP_DEBUG;
}

Always enable in development

add_filter( 'wpd_ai_session_tracking_enable_logging', function( $enable_logging ) {
    return wp_get_environment_type() === 'development';
} );

Related Filters

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