gform_pre_log_message

Description

The gform_pre_log_message action runs before a logging message is sent, regardless of whether logging is enabled.

Usage

add_action( 'gform_pre_log_message', 'your_function_name', 10, 4 );

Parameters

ParameterTypeDescription
$pluginstringPlugin name.
$messagestringThe logging message.
$message_typeintThe logging message type.
$enabledboolWhether logging is enabled for this specific add-on or plugin.

Examples

Email Log Messages.

This example sends an email notification for every log message:

add_action( 'gform_pre_log_message', 'email_log', 10, 4 );
function email_log( $plugin, $message, $message_type, $enabled ) {
    $body = $plugin . ' just sent a message: ' . $message;
    wp_mail( '[email protected]', 'logging message', $body );
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms 2.9.25

Source Code

This action is located in GFLogging::log() in logging.php.