FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
189 stars 228 forks source link

[BUGFIX] Replaced deprecated GeneralUtility::sysLog calls with new logging API #1676

Closed bink closed 3 years ago

bink commented 4 years ago

Fixes #1649

olinox14 commented 3 years ago

This pull request should be merged, I faced the very same issue, and I solved the bug by manually applying those changes

TrueType commented 3 years ago

what about it?

NamelessCoder commented 3 years ago

I'd like to merge this but doing so would break compatibility with 8.7. AFAICS it won't be possible to make use of the LoggerAware interface and trait so we would need a different solution for this (one that uses Logger without implementing the trait and interface, and which falls back to GeneralUtility::sysLog in case Logger doesn't exist or TYPO3 version is detected as 8.7.x).

olinox14 commented 3 years ago

What about a dedicated Logger class that would implement the new 9.5+ interface, and a second class which would simply call the old GeneralUtility::sysLog, the first one would be the default one, but the second would replace it only if typo3 version is inferior to 9?

Could we use XClasses to implement this? Something like:

if ((int) explode('.', TYPO3_version)[0] < 9 ){
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][FluidTYPO3\Vhs\Utility\LoggerUtility::class] = [
        'className' => FluidTYPO3\Vhs\Utility\Retrocompatibility\LoggerUtility::class
    ];
}
NamelessCoder commented 3 years ago

@olinox14 Since there are only two instances of GeneralUtility::sysLog being used, a Utility is overkill. I'd rather see a condition with a version check in those two places, where LogManager is used to retrieve a Logger instance if TYPO3 version is >= 9.5. This also means that the interface and trait should not be used because this will cause class parsing failures on versions where these are not available.