# double-opt-in/3.0.62/core/Debug.php

Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification, version 3.0.62. 25 lines.

- Page: https://pluginprobe.com/plugins/double-opt-in/3.0.62/code/core/Debug.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/3.0.62/raw/core/Debug.php
- Modified: 2025-04-09T07:42:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/double-opt-in/3.0.62/code/core/Debug.php#L10-L20`.

```php
<?php
/**
 * Function: f12_debug_log
 * Version: 1.0.0
 * Description: Logs debug messages to the error log if WP_DEBUG is enabled. Optionally includes context data.
 */
if (!function_exists('f12_debug_log')) {
	/**
	 * Logs a debug message with optional context.
	 *
	 * @param string $message The debug message to log.
	 * @param array $context Additional context data to include in the log (optional).
	 * @return void
	 */
	function f12_debug_log(string $message, array $context = []): void
	{
		if (!defined('WP_DEBUG') || WP_DEBUG !== true) {
			return;
		}

		$context_str = !empty($context) ? json_encode($context) : '';
		$log_entry = sprintf("%s %s\n", $message, $context_str);
		error_log($log_entry);
	}
}
```
