<?php


namespace Fliegerlogin;


use Fliegerlogin\Premium\DebugLog;


/**
 * Logging seam for the free core.
 *
 * The authentication flow and the API client are instrumented throughout. The
 * recorder behind it - the rolling buffer and its admin viewer - is a paid
 * feature, so in the package published on WordPress.org this class has nothing
 * to write to and every call is discarded.
 */
class Debug {

	public static function isEnabled(): bool {
		return class_exists(DebugLog::class) && DebugLog::isEnabled();
	}

	/**
	 * @param string              $event   Short event tag, e.g. "auth.skip_existing_wp_user".
	 * @param array<string,mixed> $context Key/value pairs. Sensitive keys are auto-redacted.
	 */
	public static function log(string $event, array $context = []): void {
		if (self::isEnabled()) {
			DebugLog::log($event, $context);
		}
	}

}
