info( $message, [ 'source' => self::SOURCE ] ); } /** Always logged. */ public static function error( string $message ): void { self::wc()->error( $message, [ 'source' => self::SOURCE ] ); } /** * Logged only when debug mode is enabled. * Use for full request URLs (password redacted), raw responses, flow steps. */ public static function debug( string $message ): void { if ( self::$debug_enabled ) { self::wc()->debug( $message, [ 'source' => self::SOURCE ] ); } } // ── Utility ───────────────────────────────────────────────────────────── /** * Strip the password parameter from a phpList URL before logging it. * * @param string $url Full API URL. * @return string URL with password value replaced by ***. */ public static function redact_url( string $url ): string { return preg_replace( '/(\bpassword=)[^&]+/', '$1***', $url ); } public static function is_debug_enabled(): bool { return self::$debug_enabled; } // ── Internal ───────────────────────────────────────────────────────────── /** Return (and lazy-load) the WC_Logger instance. */ private static function wc(): WC_Logger_Interface { if ( self::$wc_logger === null ) { self::$wc_logger = wc_get_logger(); } return self::$wc_logger; } }