Volodymyr Panivko created THRIFT-6009:
-----------------------------------------

             Summary: Add PSR-3 logger support and runtime deprecation warnings 
to PHP transports
                 Key: THRIFT-6009
                 URL: https://issues.apache.org/jira/browse/THRIFT-6009
             Project: Thrift
          Issue Type: Improvement
          Components: PHP - Library
            Reporter: Volodymyr Panivko


h3. Problem

The PHP socket transports ({{TSocket}}, {{TSSLSocket}}, {{TSocketPool}}) accept 
a {{$debugHandler}} typed {{callable|string|null}}, defaulting to 
{{'error_log'}}, invoked via {{call_user_func()}}. This forces users to wrap 
PSR-3 loggers in closures and prevents per-call-site log levels.

Additionally, {{TSSLServerSocket::getSSLHost()}} is marked {{@deprecated}} in 
its docblock but emits no runtime warning, so consumers cannot discover they 
are on a path slated for removal.

h3. Proposed change

* Add {{psr/log: ^1.0 || ^2.0 || ^3.0}} to {{composer.json}} (Thrift is a 
consumer of the interface, not an implementer, so the multi-major constraint is 
safe).
* Widen {{$debugHandler}} on {{TSocket}}, {{TSSLSocket}}, {{TSocketPool}} to 
{{Psr\Log\LoggerInterface|callable|string|null}}.
* Use {{NullLogger}} as the default; map call sites to {{Psr\Log\LogLevel}} 
constants ({{DEBUG}} for retry-interval-elapsed, {{WARNING}} for 
marking-host-down, {{ERROR}} for connection failures and all-hosts-down).
* Emit {{E_USER_DEPRECATED}} via {{trigger_error()}} when a string handler is 
passed (legacy form). Existing callable handlers continue to work unchanged.
* Emit {{E_USER_DEPRECATED}} from {{TSSLServerSocket::getSSLHost()}} at runtime.

h3. Behavior change

The default no-handler path changes from PHP's {{error_log}} to {{NullLogger}} 
(silent). Pre-1.0 release license — users wanting the old behavior pass a 
{{LoggerInterface}} or a closure wrapping {{error_log}}.

h3. Tests

Unit-test coverage for all new paths (LoggerInterface dispatch with per-site 
levels, deprecation trigger on string handler, default-path silence, getSSLHost 
deprecation).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to