gform_logging_message

Description

Use this filter to customize the messages sent to Gravity Forms logging. If the result returned is false, the message will not be logged. This is useful in multiple cases:

  • Sites which do not want to write logging to disk but rely on a separate logging framework or send to stdout via error_log.
  • Sites which want to customize the formatting or content of the logging messages.

Parameters

  • $message string

    The current logging message.

  • $message_type string

    The current logging message type.

  • $plugin_setting array

    The logging setting for plugin.

  • $log object

    The KLogger instance.

  • $GFLogging object

    The Gravity Forms Logging object.

Example

This example shows how to override the default logging behavior in Gravity Forms and log all enabled Gravity Forms logging statements to your system’s error logs rather than the default Gravity Forms log files located within your WordPress install’s uploads directory.

add_filter( 'gform_logging_message', 'gform_debug_logging_stdout', 10, 5 );
function gform_debug_logging_stdout( $message, $message_type, $plugin_setting, $log, $GFLogging ) {
	error_log( $message );
	return false;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 2.4.15

Source Code

This filter is located in GFLogging::log_message in logging.php: