Parsoid/JS supports a number of trace, dump, debug flags that lets us trace and debug code. It does this without requiring logging statements in the code to inspect the state of enabled flags. Parsoid/PHP needs to support similar functionality. It can do this with possibly some simple util helpers without needing to support the full complexity of powerful and generic support for log event subscribers that Parsoid/JS supports.
All public access to traceFlags, dumpFlags in $env should be removed, inspection of specific flags should be replaced by $env methods (hasTraceFlag, hasDumpFlag, etc) (currently SiteConfig provides these, but not sure they belong there), the $env->log method should delegate logging support to a LoggingUtils.