All features

Cherry Blossom feature

Framework Traits: Logging trait

Provides debug-log helpers gated by WordPress debug constants.

Provides debug-log helpers gated by WordPress debug constants.

Capabilities and extension points

Writes data to the debug log when logging is enabled.

Data that can't be printed (like arrays) will be converted to string first.

  • param mixed $message Data to log.
  • return self Consuming object for method chaining.

Writes arbitrary data to the WordPress debug log when enabled.

  • param mixed $data Data to log.
  • return self Consuming object for method chaining.

JSON-encodes data before writing it to the debug log.

  • param mixed $data Data to encode and log.
  • return self Consuming object for method chaining.

Determines whether WordPress file logging is active.

  • return bool Whether WP_DEBUG and WP_DEBUG_LOG are enabled.

Source reference

This editable reference page is based on the PHP documentation in framework/traits/debugging/trait-logging.php.