Skip to main content

Gravity_Forms\Gravity_Forms\Abilities\GF_Abilities_Logger

Logs ability executions to a dedicated Gravity Forms logging subsystem.

Provides an audit trail for the abilities/MCP system: every execution is logged with the acting user, write and destructive operations are logged at INFO level, and failures and permission denials are logged at ERROR level. Input values are reduced to an IDs-only summary so form field values (PII) never reach log files.

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:16

Details

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\Abilities

Methods

MethodDescription
register_logging_hooks()Register hooks that expose the logging subsystem.
register_execution_hooks()Register hooks that log ability executions.
filter_logging_supported()Add the abilities subsystem to the supported logging plugins.
maybe_seed_logger_setting()Seed the logger setting when logging is already enabled site-wide.
before_execute()Log the start of an ability execution.
after_execute()Log the result of an ability execution.
permission_denied()Log a denied ability execution attempt.

Method Reference

register_logging_hooks()

public function register_logging_hooks()

Register hooks that expose the logging subsystem.

These run even when MCP is disabled so the subsystem remains visible and manageable on the Forms > Settings > Logging page.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:76

register_execution_hooks()

public function register_execution_hooks()

Register hooks that log ability executions.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:88

filter_logging_supported()

public function filter_logging_supported( $plugins )

Add the abilities subsystem to the supported logging plugins.

Parameters

NameTypeDefaultDescription
$pluginsarrayRegistered logging subsystems.

Returns

  • array

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:103

maybe_seed_logger_setting()

public function maybe_seed_logger_setting()

Seed the logger setting when logging is already enabled site-wide.

GFLogging only enables loggers for known subsystems when the global logging toggle is switched on. If logging was enabled before this subsystem existed, the slug has no saved setting and would stay silent until logging is toggled again, so it is seeded the same way GFLogging::enable_all_loggers() would. Runs on gform_post_upgrade — the only window where an existing setup gains this subsystem — and is idempotent in place of a version_compare gate.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:124

before_execute()

public function before_execute( $ability_name, $input, $ability )

Log the start of an ability execution.

Parameters

NameTypeDefaultDescription
$ability_namestringThe registered ability name.
$inputarrayThe input passed to the ability.
$abilityobjectThe ability instance being executed.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:165

after_execute()

public function after_execute( $ability_name, $input, $result, $ability )

Log the result of an ability execution.

Failures are logged at ERROR level, successful write and destructive operations at INFO level, and successful read-only operations at DEBUG level.

Parameters

NameTypeDefaultDescription
$ability_namestringThe registered ability name.
$inputarrayThe input passed to the ability.
$resultmixedThe execution result (may be a WP_Error).
$abilityobjectThe ability instance that was executed.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:194

permission_denied()

public function permission_denied( $ability_name, $input, $ability )

Log a denied ability execution attempt.

Parameters

NameTypeDefaultDescription
$ability_namestringThe registered ability name.
$inputarrayThe input passed to the ability.
$abilityobjectThe ability instance that was denied.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-abilities-logger.php:238